From a8a3251a73f62698ee628a40e5761229421aaa18 Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Fri, 6 Oct 2023 13:27:05 -0500 Subject: [PATCH 1/2] Update java other examples --- .../java/agent-nr-config/config-extension/build.gradle | 2 +- .../main/java/com/newrelic/otel/extension/Customizer.java | 5 +++-- .../java/logs-in-context-log4j2/docker-compose.yaml | 2 ++ other-examples/java/logs-in-context-log4j2/log4j2.xml | 2 +- other-examples/java/logs-in-context-log4j2/otel-config.yaml | 2 -- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/other-examples/java/agent-nr-config/config-extension/build.gradle b/other-examples/java/agent-nr-config/config-extension/build.gradle index 6e0c1a31..3898f2bf 100644 --- a/other-examples/java/agent-nr-config/config-extension/build.gradle +++ b/other-examples/java/agent-nr-config/config-extension/build.gradle @@ -18,7 +18,7 @@ jar { dependencies { compileOnly 'io.opentelemetry:opentelemetry-sdk-extension-autoconfigure' - compileOnly 'io.opentelemetry:opentelemetry-semconv' + compileOnly 'io.opentelemetry.semconv:opentelemetry-semconv:1.21.0-alpha' implementation "io.opentelemetry.contrib:opentelemetry-samplers:1.30.0-alpha" } \ No newline at end of file diff --git a/other-examples/java/agent-nr-config/config-extension/src/main/java/com/newrelic/otel/extension/Customizer.java b/other-examples/java/agent-nr-config/config-extension/src/main/java/com/newrelic/otel/extension/Customizer.java index 4e920696..aef28f54 100644 --- a/other-examples/java/agent-nr-config/config-extension/src/main/java/com/newrelic/otel/extension/Customizer.java +++ b/other-examples/java/agent-nr-config/config-extension/src/main/java/com/newrelic/otel/extension/Customizer.java @@ -1,6 +1,6 @@ package com.newrelic.otel.extension; -import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.SERVICE_INSTANCE_ID; +import static io.opentelemetry.semconv.ResourceAttributes.SERVICE_INSTANCE_ID; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.contrib.sampler.RuleBasedRoutingSampler; @@ -8,7 +8,7 @@ import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider; import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.samplers.Sampler; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.SemanticAttributes; import java.util.UUID; /** @@ -32,6 +32,7 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) { sdkTracerProviderBuilder.setSampler( Sampler.parentBased( RuleBasedRoutingSampler.builder(SpanKind.SERVER, Sampler.alwaysOn()) + // TODO: Update to url.path when semconv 1.22.0 is published .drop(SemanticAttributes.HTTP_TARGET, "/actuator.*") .build()))); } diff --git a/other-examples/java/logs-in-context-log4j2/docker-compose.yaml b/other-examples/java/logs-in-context-log4j2/docker-compose.yaml index c453cb44..97ad1a44 100644 --- a/other-examples/java/logs-in-context-log4j2/docker-compose.yaml +++ b/other-examples/java/logs-in-context-log4j2/docker-compose.yaml @@ -8,6 +8,8 @@ services: OTEL_LOGS_EXPORTER: none OTEL_EXPORTER_OTLP_ENDPOINT: 'http://collector:4317' OTEL_EXPERIMENTAL_RESOURCE_DISABLED_KEYS: 'process.command_line,process.command_args' + OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE: 'delta' + OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT: 4095 ports: - '8080:8080' logging: diff --git a/other-examples/java/logs-in-context-log4j2/log4j2.xml b/other-examples/java/logs-in-context-log4j2/log4j2.xml index 4c8df5d5..990de6e1 100644 --- a/other-examples/java/logs-in-context-log4j2/log4j2.xml +++ b/other-examples/java/logs-in-context-log4j2/log4j2.xml @@ -2,7 +2,7 @@ - + diff --git a/other-examples/java/logs-in-context-log4j2/otel-config.yaml b/other-examples/java/logs-in-context-log4j2/otel-config.yaml index 463576f1..cf0d3089 100644 --- a/other-examples/java/logs-in-context-log4j2/otel-config.yaml +++ b/other-examples/java/logs-in-context-log4j2/otel-config.yaml @@ -18,8 +18,6 @@ processors: # https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/README.md#trace-context-in-legacy-formats - replace_pattern(body, "\"trace_id\":", "\"trace.id\":") - replace_pattern(body, "\"span_id\":", "\"span.id\":") - # Truncate log bodies to 4095 characters - - set(body, Substring(body, 0, 4095)) where Len(body) >= 4095 exporters: logging: verbosity: $LOG_EXPORTER_LOG_VERBOSITY From d0a9b8bfa4e72d5df8358121040cade7e036feed Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Fri, 6 Oct 2023 13:32:14 -0500 Subject: [PATCH 2/2] Make scripts executable --- getting-started-guides/java/uninstrumented/call-app.sh | 0 getting-started-guides/java/uninstrumented/load-generator.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 getting-started-guides/java/uninstrumented/call-app.sh mode change 100644 => 100755 getting-started-guides/java/uninstrumented/load-generator.sh diff --git a/getting-started-guides/java/uninstrumented/call-app.sh b/getting-started-guides/java/uninstrumented/call-app.sh old mode 100644 new mode 100755 diff --git a/getting-started-guides/java/uninstrumented/load-generator.sh b/getting-started-guides/java/uninstrumented/load-generator.sh old mode 100644 new mode 100755