|
1 | | -# kafka-dropwizard-reporter [](https://travis-ci.org/SimpleFinance/kafka-dropwizard-reporter) |
| 1 | +# kafka-dropwizard-reporter |
2 | 2 |
|
3 | | -This package provides a `DropwizardReporter` class that connects the |
4 | | -built-in metrics maintained by Kafka's client libraries with |
5 | | -Dropwizard Metrics 3.0+. |
6 | | -The Kafka metrics are added as `Gauge` instances to a Dropwizard |
7 | | -`MetricRegistry` instance. |
| 3 | +## Unmaintained! See Fork! |
8 | 4 |
|
9 | | -If you're already using Dropwizard Metrics in your application |
10 | | -to serve metrics via HTTP, Graphite, StatsD, etc., |
11 | | -this reporter provides an easy bridge to pass Kafka consumer, |
12 | | -producer, and streams metrics to those same outputs. |
| 5 | +This project is no longer maintained and no longer works with Kafka 3.0.0+. For a newer version, see the fork: |
13 | 6 |
|
14 | | -## Compatibility |
15 | | - |
16 | | -`dropwizard-metrics` 3.0 and above. |
17 | | - |
18 | | -`kafka-clients` 0.8.1 and above, including 0.9, 0.10, 0.11, and 1.0. |
19 | | -Also functions with Kafka Streams and Kafka Connect. |
20 | | - |
21 | | - |
22 | | -## Usage |
23 | | - |
24 | | -First, declare a dependency on this package and on the explicit versions |
25 | | -of the dependencies that you want: |
26 | | -```xml |
27 | | - <dependency> |
28 | | - <groupId>com.simple</groupId> |
29 | | - <artifactId>kafka-dropwizard-reporter</artifactId> |
30 | | - <version>1.1.1</version> |
31 | | - </dependency> |
32 | | - |
33 | | - <!-- Required; you must provide metrics-core and kafka-clients; |
34 | | - versions can be more recent than those shown below --> |
35 | | - <dependency> |
36 | | - <groupId>io.dropwizard.metrics</groupId> |
37 | | - <artifactId>metrics-core</artifactId> |
38 | | - <version>3.1.2</version> |
39 | | - </dependency> |
40 | | - <dependency> |
41 | | - <groupId>org.apache.kafka</groupId> |
42 | | - <artifactId>kafka-clients</artifactId> |
43 | | - <version>0.9.0.1</version> |
44 | | - <scope>provided</scope> |
45 | | - </dependency> |
46 | | - |
47 | | - <!-- Optional; the user is expected to specify this dependency |
48 | | - explicitly if DropwizardReporterGraphite is to be used --> |
49 | | - <dependency> |
50 | | - <groupId>io.dropwizard.metrics</groupId> |
51 | | - <artifactId>metrics-graphite</artifactId> |
52 | | - <version>3.1.2</version> |
53 | | - <scope>provided</scope> |
54 | | - </dependency> |
55 | | -``` |
56 | | - |
57 | | -Then, include the `DropwizardReporter` class in the properties you pass |
58 | | -to producers, consumers, and `KafkaStreams` applications: |
59 | | -``` |
60 | | -metric.reporters=com.simple.metrics.kafka.DropwizardReporter |
61 | | -``` |
62 | | - |
63 | | -That client will now automatically register all of its built-in |
64 | | -metrics with a Dropwizard `MetricRegistry` when it's initialized. |
65 | | -The registry is discovered by calling |
66 | | -`SharedMetricRegistries.getOrCreate("default")`, |
67 | | -so to direct `DropwizardReporter` to a particular registry, make |
68 | | -sure to call `SharedMetricRegistries.add("default", myRegistry)` |
69 | | -before instantiating Kafka clients if you want metrics to belong |
70 | | -to `myRegistry`. |
71 | | - |
72 | | -For a full example of integrating Kafka client metrics in a Dropwizard |
73 | | -application, see [example/](example/). |
74 | | - |
75 | | -## Reporting to Graphite |
76 | | - |
77 | | -If your application is not already handling reporting of metrics to an external |
78 | | -source, you can use `com.simple.metrics.kafka.DropwizardReporterGraphite` |
79 | | -which adds instantiation of a `GraphiteReporter`. |
80 | | -Make sure you've declared a dependency on `metrics-graphite`, then |
81 | | -see <a href="configuration">Configuration</a> below. |
82 | | - |
83 | | -## Configuration |
84 | | - |
85 | | -The following configuration options are available: |
86 | | - |
87 | | -<table class="data-table"><tbody> |
88 | | -<tr> |
89 | | -<th>Name</th> |
90 | | -<th>Description</th> |
91 | | -<th>Type</th> |
92 | | -<th>Default</th> |
93 | | -<th>Valid Values</th> |
94 | | -<th>Importance</th> |
95 | | -</tr> |
96 | | -<tr> |
97 | | -<td>metric.dropwizard.graphite.host</td><td>Destination host for the GraphiteReporter (default: localhost); only relevant for DropwizardReporterGraphite</td><td>string</td><td>localhost</td><td></td><td>low</td></tr> |
98 | | -<tr> |
99 | | -<td>metric.dropwizard.graphite.port</td><td>Destination port for the GraphiteReporter (default: 2003); only relevant for DropwizardReporterGraphite</td><td>int</td><td>2003</td><td></td><td>low</td></tr> |
100 | | -<tr> |
101 | | -<td>metric.dropwizard.graphite.prefix</td><td>Metric prefix for metrics published by the GraphiteReporter; only relevant for DropwizardReporterGraphite</td><td>string</td><td>""</td><td></td><td>low</td></tr> |
102 | | -<tr> |
103 | | -<td>metric.dropwizard.registry</td><td>Name of the dropwizard-metrics registry to use; passed to SharedMetricRegistries.getOrCreate</td><td>string</td><td>default</td><td></td><td>low</td></tr> |
104 | | -</tbody></table> |
105 | | - |
106 | | -If you'd like to send Kafka metrics to a separate `MetricRegistry` instance, |
107 | | -you can pass a name as `metric.dropwizard.registry` when configuring the client. |
108 | | -For example, the following would end up calling |
109 | | -`SharedMetricRegistries.getOrCreate("kafka-metrics")`: |
110 | | -``` |
111 | | -metric.reporters=com.simple.metrics.kafka.DropwizardReporter |
112 | | -metric.dropwizard.registry=kafka-metrics |
113 | | -``` |
114 | | - |
115 | | -A configuration using Graphite reporting could be: |
116 | | -``` |
117 | | -metric.reporters=com.simple.metrics.kafka.DropwizardGraphiteReporter |
118 | | -metric.dropwizard.graphite.host=localhost |
119 | | -metric.dropwizard.graphite.port=2003 |
120 | | -metric.dropwizard.graphite.prefix=mycompany.myproject |
121 | | -``` |
122 | | - |
123 | | -Note that usage of these configuration options might trigger warning messages like |
124 | | -`org.apache.kafka.clients.consumer.ConsumerConfig: The configuration metric.dropwizard.registry = kafka-metrics was supplied but isn't a known config.` |
125 | | -due to a bug in Kafka's configuration machinery present until at least version 0.10.0.0. |
126 | | -This was addressed in [KAFKA-3711](https://issues.apache.org/jira/browse/KAFKA-3711). |
127 | | - |
128 | | -## Building |
129 | | - |
130 | | -To build the project, you'll need to |
131 | | -[install Apache Maven 3](https://maven.apache.org/install.html). |
132 | | -If you're on Mac OS X, you can install Maven via [Homebrew](http://brew.sh/): |
133 | | - |
134 | | - $ brew install maven |
135 | | - |
136 | | -Once that's installed, run the following from main directory |
137 | | -(where `pom.xml` lives): |
138 | | -``` |
139 | | -mvn clean install |
140 | | -``` |
141 | | - |
142 | | -## Deploying |
143 | | - |
144 | | -To deploy to Maven Central, you'll need to provide GPG signatures for all |
145 | | -the artifacts. There's a `sign` profile for this purpose: |
146 | | - |
147 | | - mvn clean verify -Psign |
148 | | - |
149 | | -Check that the output looks good. You should a jar, sources, javadoc, and pom, |
150 | | -each with a signed `.asc` companion: |
151 | | -``` bash |
152 | | -$ ls target/kafka-* |
153 | | -target/kafka-dropwizard-reporter-1.1.1-javadoc.jar target/kafka-dropwizard-reporter-1.1.1.jar |
154 | | -target/kafka-dropwizard-reporter-1.1.1-javadoc.jar.asc target/kafka-dropwizard-reporter-1.1.1.jar.asc |
155 | | -target/kafka-dropwizard-reporter-1.1.1-sources.jar target/kafka-dropwizard-reporter-1.1.1.pom |
156 | | -target/kafka-dropwizard-reporter-1.1.1-sources.jar.asc target/kafka-dropwizard-reporter-1.1.1.pom.asc |
157 | | -``` |
158 | | - |
159 | | -If the `target` directory looks good, deploy: |
160 | | - |
161 | | - mvn deploy -Psign |
162 | | - |
163 | | -You'll need to have an account with Maven Central as part of the `com.simple` |
164 | | -group. Contact the project maintainer for more info. |
165 | | -Visit https://oss.sonatype.org/index.html#stagingRepositories |
166 | | -and close the new staging repository (named something like `comsimple-XXXX`). |
167 | | -Wait a few minutes, then select the repo again and "Release" it. |
168 | | -If there is no "Release" button, something is wrong with your artifacts, |
169 | | -or they haven't been closed out yet. |
170 | | - |
171 | | -Once released, it will take some time for Maven Central to sync and for the |
172 | | -artifact to be available. |
173 | | - |
174 | | -## Contributing |
175 | | - |
176 | | -Contributions, feature requests, and bug reports are all welcome. |
177 | | -Feel free to [submit an issue](issues/new) |
178 | | -or submit a pull request to this repo. |
179 | | - |
180 | | -## Changelog |
181 | | - |
182 | | -Check the [releases](https://github.com/SimpleFinance/kafka-dropwizard-reporter/releases) |
183 | | -page for summaries of what has changed in each release. |
| 7 | +https://github.com/baunz/kafka-dropwizard-reporter |
184 | 8 |
|
185 | 9 | ## Also See |
186 | 10 |
|
|
0 commit comments