Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update java apps #458

Merged
merged 2 commits into from
Oct 13, 2023
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
Empty file modified getting-started-guides/java/uninstrumented/call-app.sh
100644 → 100755
Empty file.
Empty file modified getting-started-guides/java/uninstrumented/load-generator.sh
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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;
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer;
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;

/**
Expand All @@ -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())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion other-examples/java/logs-in-context-log4j2/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Configuration status="WARN" monitorInterval="30">
<Appenders>
<Console name="ConsoleAppender" target="SYSTEM_OUT" follow="true">
<JsonTemplateLayout eventTemplateUri="classpath:Log4j2EventLayout.json" maxStringLength="1000"/>
<JsonTemplateLayout eventTemplateUri="classpath:Log4j2EventLayout.json"/>
</Console>
</Appenders>
<Loggers>
Expand Down
2 changes: 0 additions & 2 deletions other-examples/java/logs-in-context-log4j2/otel-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down