1- .. _geomesa_metrics :
2-
31Micrometer Metrics
42==================
53
6- GeoMesa has initial support for `Micrometer <https://docs.micrometer.io/micrometer/reference/ >`__ metrics. Currently,
7- metrics can integrate with either Prometheus or Cloudwatch. Creating registries is idempotent, as long as the
8- configuration does not change.
9-
10- Most GeoMesa data stores support the parameters ``geomesa.metrics.registry `` and ``geomesa.metrics.registry.config ``, which are
11- used to start up a registry for publishing metrics. Configuration is described below.
12-
13- When enabled, various GeoMesa components will publish metrics, including the :ref: `kafka_index ` and :ref: `converters `.
14-
15- Prometheus Registry
16- -------------------
17-
18- The Prometheus registry can be configured through the following environment variables:
19-
20- +--------------------------------------+---------+----------------------------------------------+
21- | Environment Variable | Default | Description |
22- +======================================+=========+==============================================+
23- | ``RENAME_PROMETHEUS_METRICS `` | true | `Rename `__ metrics |
24- +--------------------------------------+---------+----------------------------------------------+
25- | ``METRICS_APPLICATION_NAME `` | geomesa | Add a tag for ``application `` to all metrics |
26- +--------------------------------------+---------+----------------------------------------------+
27- | ``METRICS_PORT `` | 9090 | Set the port used to host metrics |
28- +--------------------------------------+---------+----------------------------------------------+
29-
30- __ https://docs.micrometer.io/micrometer/reference/implementations/prometheus.html#_the_prometheus_rename_filter
31-
32- Instead of environment variables, the registry can be fully configured using using the data store parameter
33- ``geomesa.metrics.registry.config ``, which takes `Lightbend Config <https://github.com/lightbend/config/tree/main >`__:
34-
35- ::
36-
37- # port used to serve metrics - not used if push-gateway is defined
38- port = 9090
39- # tags applied to all metrics, may be any key-value string pairs
40- common-tags = { "application" = "my-app" }
41- # use prometheus "standard" names - see https://docs.micrometer.io/micrometer/reference/implementations/prometheus.html#_the_prometheus_rename_filter
42- rename = false
43- # additional config - can also be done via sys props, see https://prometheus.github.io/client_java/config/config/
44- properties = {}
45- # optional - enable pushgateway for short-lived jobs, instead of the standard metrics server for scraping
46- push-gateway = {
47- host = "localhost:9091"
48- job = "my-job"
49- scheme = "http"
50- format = "PROMETHEUS_PROTOBUF" # or PROMETHEUS_TEXT
51- }
52-
53- If using Pushgateway, the following dependency is required:
54-
55- .. code-block :: xml
56-
57- <dependency >
58- <groupId >io.prometheus</groupId >
59- <artifactId >prometheus-metrics-exporter-pushgateway</artifactId >
60- <version >{{prometheus_version}}</version >
61- </dependency >
62-
63- Cloudwatch Registry
64- -------------------
65-
66- The Cloudwatch registry can be configured through the following environment variables:
67-
68- +--------------------------------------+---------+----------------------------------------------+
69- | Environment Variable | Default | Description |
70- +======================================+=========+==============================================+
71- | ``METRICS_NAMESPACE `` | geomesa | Cloudwatch namespace |
72- +--------------------------------------+---------+----------------------------------------------+
73-
74- Instead of environment variables, the registry can be fully configured using using the data store parameter
75- ``geomesa.metrics.registry.config ``, which takes `Lightbend Config <https://github.com/lightbend/config/tree/main >`__:
76-
77- ::
78-
79- # cloudwatch namespace
80- namespace = "geomesa"
81- # properties for the cloudwatch client
82- properties = {}
83-
84- For Cloudwatch, the following dependency is required:
85-
86- .. code-block :: xml
87-
88- <dependency >
89- <groupId >io.micrometer</groupId >
90- <artifactId >micrometer-registry-cloudwatch2</artifactId >
91- <version >{{micrometer_version}}</version >
92- </dependency >
93-
94- Instrumentations
95- ----------------
96-
97- When adding a registry, additional JVM metrics can be exposed with the following environment variables:
98-
99- +--------------------------------------+---------+----------------------------------------------+
100- | Environment Variable | Default | Description |
101- +======================================+=========+==============================================+
102- | ``METRICS_INSTRUMENTATIONS_ENABLED `` | true | Enable all JVM instrumentations |
103- +--------------------------------------+---------+----------------------------------------------+
104-
105- Individual instrumentations can be enabled or disabled through the following environment variables:
106-
107- +--------------------------------------+---------+----------------------------------------------+
108- | Environment Variable | Default | Description |
109- +======================================+=========+==============================================+
110- | ``METRICS_INSTRUMENT_CLASSLOADER `` | | Enable metrics on JVM class loading |
111- +--------------------------------------+---------+----------------------------------------------+
112- | ``METRICS_INSTRUMENT_MEMORY `` | | Enable metrics on JVM memory usage |
113- +--------------------------------------+---------+----------------------------------------------+
114- | ``METRICS_INSTRUMENT_GC `` | | Enable metrics on JVM garbage collection |
115- +--------------------------------------+---------+----------------------------------------------+
116- | ``METRICS_INSTRUMENT_PROCESSOR `` | | Enable metrics on processor usage |
117- +--------------------------------------+---------+----------------------------------------------+
118- | ``METRICS_INSTRUMENT_THREADS `` | | Enable metrics on JVM thread usage |
119- +--------------------------------------+---------+----------------------------------------------+
120- | ``METRICS_INSTRUMENT_COMMONS_POOL `` | | Enable metrics on Apache commons-pool pools |
121- +--------------------------------------+---------+----------------------------------------------+
122- | ``METRICS_INSTRUMENT_POSTGRES `` | | Enable metrics on PostgreSQL |
123- +--------------------------------------+---------+----------------------------------------------+
124-
125- Or, when using ``geomesa.metrics.registry.config ``, use the following keys:
126-
127- ::
128-
129- # tags are key-value string pairs added to metrics from the given instrumentation
130- classloader = { enabled = true, tags = {} }
131- memory = { enabled = true, tags = {} }
132- gc = { enabled = true, tags = {} }
133- processor = { enabled = true, tags = {} }
134- threads = { enabled = true, tags = {} }
135- commons-pool = { enabled = true, tags = {} }
136- postgres = { enabled = true, tags = {} }
137-
138- .. note ::
139-
140- PostgreSQL metrics are only available in the :ref: `postgis_index_page `.
141-
142- Standalone Usage
143- ----------------
144-
145- Registries can also be managed programmatically. This allows for greater flexibility and usage outside the normal GeoMesa
146- workflows. Configuration can be managed as detailed above.
4+ GeoMesa provide built-in :ref: `geomesa_metrics ` integrations. However, registries can also be managed programmatically, which
5+ allows for greater flexibility and usage outside the normal GeoMesa workflows. Configuration is detailed in :ref: `geomesa_metrics `.
1476
1487Prometheus
1498^^^^^^^^^^
@@ -183,7 +42,7 @@ To idempotently create a Prometheus registry and attach it to the global registr
18342 import com.typesafe.config.ConfigFactory;
18443 import org.locationtech.geomesa.metrics.micrometer.prometheus.PrometheusFactory;
18544
186- // call close() on the result to shut down the server
45+ // call close() on the result to deregister the server
18746 // this call uses environment variables to configure the registry
18847 Closeable registry = PrometheusFactory.register();
18948 // alternatively, use the method that accepts configuration directly
@@ -199,7 +58,7 @@ To idempotently create a Prometheus registry and attach it to the global registr
19958 import com.typesafe.config.ConfigFactory
20059 import org.locationtech.geomesa.metrics.micrometer.prometheus.PrometheusFactory
20160
202- // call close() on the result to shut down the server
61+ // call close() on the result to deregister the server
20362 // this call uses environment variables to configure the registry
20463 val registry: Closeable = PrometheusFactory.register()
20564 // alternatively, use the method that accepts configuration directly
@@ -279,7 +138,7 @@ To idempotently start a Cloudwatch registry and attach it to the global registry
279138 import com.typesafe.config.ConfigFactory;
280139 import org.locationtech.geomesa.metrics.micrometer.cloudwatch.CloudwatchFactory;
281140
282- // call close() on the result to shut down the server
141+ // call close() on the result to deregister the server
283142 // this call uses environment variables to configure the registry (see below)
284143 Closeable registry = CloudwatchFactory.register();
285144 // or, for full control pass in a configuration
@@ -290,7 +149,7 @@ To idempotently start a Cloudwatch registry and attach it to the global registry
290149 import com.typesafe.config.ConfigFactory
291150 import org.locationtech.geomesa.metrics.micrometer.cloudwatch.CloudwatchFactory
292151
293- // call close() on the result to shut down the server
152+ // call close() on the result to deregister the server
294153 // this call uses environment variables to configure the registry (see below)
295154 val registry: Closeable = CloudwatchFactory.register()
296155 // or, for full control pass in a configuration
@@ -315,9 +174,3 @@ pooling. First, ensure that the ``commons-pool`` instrumentation is enabled (abo
315174 import org.locationtech.geomesa.metrics.micrometer.dbcp2.MetricsDataSource
316175
317176 val dataSource = new MetricsDataSource()
318-
319- Custom Registries
320- -----------------
321-
322- If the provided registries are not sufficient, metrics can be exposed by programmatically adding any Micrometer registry to the
323- `global registry <https://docs.micrometer.io/micrometer/reference/concepts/registry.html#_global_registry >`__.
0 commit comments