|
2 | 2 | {{#assign"markdown"}}
|
3 | 3 | Time series metrics reporting and alerting and an essential tool when it comes to monitoring production services. Graphs help you monitor trends over time, identify spikes in load / latency, identify bottlenecks with constrained resources, etc. [Dropwizard Metrics](https://metrics.dropwizard.io/4.0.0/) is a great library for collecting metrics and has a lot of features out of the box including various [JVM metrics](/posts/monitoring-your-jvm-with-dropwizard-metrics). There are also many third party library hooks for collections metrics on HikariCP connections pools, Redis client connections, HTTP client connections, and many more.
|
4 | 4 |
|
5 |
| -Once metrics are being collected we need a time series datastore as well as a graphing and alerting system to get the most out of our metrics. Thisexmaple will be utilizing [Grafana Cloud](https://grafana.com/cloud) which offers cloud hosted [Grafana](https://grafana.com/) a graphing and alerting application that hooks into many datasources, as well as two options for time series datasources [Graphite](https://graphiteapp.org/) and [Prometheus](https://prometheus.io/). [StubbornJava](https://www.stubbornjava.com) has public facing Grafana dashboards that will continue to add new metrics as new content is added. Take a look at the [StubbornJava Overview](https://stubbornjava.grafana.net/d/sYu06dviz/stubbornjava-overview?orgId=1) dashboard to start with. |
| 5 | +Once metrics are being collected we need a time series datastore as well as a graphing and alerting system to get the most out of our metrics. Thisexample will be utilizing [Grafana Cloud](https://grafana.com/cloud) which offers cloud hosted [Grafana](https://grafana.com/) a graphing and alerting application that hooks into many datasources, as well as two options for time series datasources [Graphite](https://graphiteapp.org/) and [Prometheus](https://prometheus.io/). [StubbornJava](https://www.stubbornjava.com) has public facing Grafana dashboards that will continue to add new metrics as new content is added. Take a look at the [StubbornJava Overview](https://stubbornjava.grafana.net/d/sYu06dviz/stubbornjava-overview?orgId=1) dashboard to start with. |
6 | 6 |
|
7 | 7 | ## Custom Dropwizard GraphiteSender
|
8 | 8 | `Note: This is not the Grafana Cloud recommended implementation`.
|
9 |
| -Grafana Cloud recommends using a Carbon-Relay-NG process for pre-aggregating and batch sending metrics to Grafana Cloud. Since this site is currently only a single server we opted to implementa HTTP sender using the Grafana Cloud API to have less infrastructure overhead. If your system has multiple environments and services it is highly recommended to use the Carbon-Relay-NG process. |
| 9 | +Grafana Cloud recommends using a Carbon-Relay-NG process for pre-aggregating and batch sending metrics to Grafana Cloud. Since this site is currently only a single server we opted to implementan HTTP sender using the Grafana Cloud API to have less infrastructure overhead. If your system has multiple environments and services it is highly recommended to use the Carbon-Relay-NG process. |
10 | 10 |
|
11 |
| -This implementation should be fairlystraight forward. Dropwizard Metrics reporters are run on a single thread on a timer so we should not have to worry about thread safety in this class.Everytime the reporter runs it will iterate all of the metrics contained in our `MetricRegistry` convert them to the appropriate format and send the data to the Grafana API using OkHttp and serializing to JSON with Jackson. |
| 11 | +This implementation should be fairlystraightforward. Dropwizard Metrics reporters are run on a single thread on a timer so we should not have to worry about thread safety in this class.Every time the reporter runs it will iterate all of the metrics contained in our `MetricRegistry` convert them to the appropriate format and send the data to the Grafana API using OkHttp and serializing to JSON with Jackson. |
12 | 12 |
|
13 | 13 | {{>templates/src/widgets/code/code-snippetfile=sendersection=sender.sections.sender}}
|
14 | 14 |
|
|