Change default metric temporality to delta by JonasKunz · Pull Request #583 · elastic/elastic-otel-java · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.next-release.md
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ in the [`span-stacktrace`](https://github.com/open-telemetry/opentelemetry-java-
Experimental runtime metrics are enabled by default.
Set `otel.instrumentation.runtime-telemetry.emit-experimental-telemetry` to `false` to disable them.


### Metric Temporality

Elasticsearch and Kibana work best with metrics provided in delta-temporality.
Therefore, the EDOT Java changes the default value of `otel.exporter.otlp.metrics.temporality.preference` to `DELTA`.
You can override this default if needed, note though that some provided Kibana dashboards will not work correctly in this case.

# License

The Elastic Distribution of OpenTelemetry Java is licensed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class ElasticAutoConfigurationCustomizerProvider
private static final String DISABLED_RESOURCE_PROVIDERS = "otel.java.disabled.resource.providers";
private static final String RUNTIME_EXPERIMENTAL_TELEMETRY =
"otel.instrumentation.runtime-telemetry.emit-experimental-telemetry";
private static final String METRIC_TEMPORALITY_PREFERENCE =
"otel.exporter.otlp.metrics.temporality.preference";

// must match value in io.opentelemetry.contrib.stacktrace.StackTraceAutoConfig
private static final String STACKTRACE_OTEL_FILTER =
Expand Down Expand Up @@ -76,6 +78,7 @@ static Map<String, String> propertiesCustomizer(ConfigProperties configPropertie
Map<String, String> config = new HashMap<>();

experimentalTelemetry(config, configProperties);
deltaMetricsTemporality(config, configProperties);
resourceProviders(config, configProperties);
spanStackTrace(config, configProperties);

Expand All @@ -90,6 +93,14 @@ private static void experimentalTelemetry(
config.put(RUNTIME_EXPERIMENTAL_TELEMETRY, Boolean.toString(experimentalTelemetry));
}

private static void deltaMetricsTemporality(
Map<String, String> config, ConfigProperties configProperties) {
// enable experimental telemetry metrics by default if not explicitly disabled
String temporalityPreference =
configProperties.getString(METRIC_TEMPORALITY_PREFERENCE, "DELTA");
config.put(METRIC_TEMPORALITY_PREFERENCE, temporalityPreference);
}

private static void resourceProviders(
Map<String, String> config, ConfigProperties configProperties) {
Set<String> disabledResourceProviders =
Expand Down