Skip to content

Commit

Permalink
Document newly supported OTLP env vars
Browse files Browse the repository at this point in the history
 See micrometer-metricsgh-4500 that added support for more environment variables. Documents that support in our reference documentation.

 Resolves micrometer-metricsgh-4566
  • Loading branch information
shakuzen committed Feb 6, 2024
1 parent d130d5e commit 71e2e5e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
8 changes: 5 additions & 3 deletions docs/modules/ROOT/pages/implementations/otlp.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ management:
aggregationTemporality: "cumulative"
headers:
header1: value1
step: 30s
resourceAttributes:
key1: value1
----

1. `url` - The URL to which data is reported. Defaults to `http://localhost:4318/v1/metrics`
2. `aggregationTemporality` - https://opentelemetry.io/docs/specs/otel/metrics/data-model/#temporality[Aggregation temporality, window=_blank] determines how the additive quantities are expressed, in relation to time. The supported values are `cumulative` or `delta`. Defaults to `cumulative`. +
1. `url` - The URL to which data is reported. Environment variables `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` and `OTEL_EXPORTER_OTLP_ENDPOINT` are also supported in the default implementation. If a value is not provided, it defaults to `http://localhost:4318/v1/metrics`
2. `aggregationTemporality` - https://opentelemetry.io/docs/specs/otel/metrics/data-model/#temporality[Aggregation temporality, window=_blank] determines how the additive quantities are expressed, in relation to time. The environment variable `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` is supported by the default implementation. The supported values are `cumulative` or `delta`. Defaults to `cumulative`. +
*Note*: This config was introduced in version 1.11.0.
3. `headers` - Additional headers to send with exported metrics. This can be used for authorization headers. By default, headers are loaded from the config. If that is not set, they can be taken from the environment variables `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS`. If a header is set in both the environmental variables, the header in the latter overrides the former.
4. `resourceAttributes` - https://opentelemetry.io/docs/specs/otel/resource/semantic_conventions/#service[Resource attributes, window=_blank] are used for all metrics published. By default, Micrometer adds the following resource attributes:
4. `step` - the interval at which metrics will be published. The environment variable `OTEL_METRIC_EXPORT_INTERVAL` is supported by the default implementation. If a value is not provided, defaults to 1 minute.
5. `resourceAttributes` - https://opentelemetry.io/docs/specs/otel/resource/semantic_conventions/#service[Resource attributes, window=_blank] are used for all metrics published. By default, Micrometer adds the following resource attributes:

[%autowidth]
|===
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@ default String prefix() {
}

/**
* Defaults to http://localhost:4318/v1/metrics
* @return address to where metrics will be published.
* If no value is returned by {@link #get(String)}, environment variables
* {@code OTEL_EXPORTER_OTLP_METRICS_ENDPOINT} and {@code OTEL_EXPORTER_OTLP_ENDPOINT}
* environment variables will be checked, in that order, by the default
* implementation.
* @return address to where metrics will be published. Default is
* {@code http://localhost:4318/v1/metrics}
* @see <a href=
* "https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/">OTLP
* Exporter Configuration</a>
*/
default String url() {
return getUrlString(this, "url").orElseGet(() -> {
Expand All @@ -70,6 +77,14 @@ else if (!endpoint.endsWith("/v1/metrics")) {
});
}

/**
* Default implementation supports the environment variable
* {@code OTEL_METRIC_EXPORT_INTERVAL} when the step value is not provided by the
* {@link #get(String)} implementation.
* @return step size (reporting frequency) to use. The default is 1 minute.
* @see <a href=
* "https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#periodic-exporting-metricreader">OTEL_METRIC_EXPORT_INTERVAL</a>
*/
@Override
default Duration step() {
Validated<Duration> step = getDuration(this, "step");
Expand Down Expand Up @@ -120,11 +135,16 @@ default Map<String, String> resourceAttributes() {
/**
* {@link AggregationTemporality} of the OtlpMeterRegistry. This determines whether
* the meters should be cumulative(AGGREGATION_TEMPORALITY_CUMULATIVE) or
* step/delta(AGGREGATION_TEMPORALITY_DELTA).
* @return the aggregationTemporality for OtlpMeterRegistry
* step/delta(AGGREGATION_TEMPORALITY_DELTA). Default implementation supports the
* environment variable {@code OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE} when
* a value is not provided by {@link #get(String)}.
* @return the aggregationTemporality; default is Cumulative
* @see <a href=
* "https://opentelemetry.io/docs/reference/specification/metrics/data-model/#temporality">OTLP
* Temporality</a>
* @see <a href=
* "https://opentelemetry.io/docs/specs/otel/metrics/sdk_exporters/otlp/#additional-configuration">OpenTelemetry
* Metrics Exporter - OTLP</a>
* @since 1.11.0
*/
default AggregationTemporality aggregationTemporality() {
Expand Down

0 comments on commit 71e2e5e

Please sign in to comment.