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

span stacktraces config (without aligning with upstream) #369

Merged
merged 12 commits into from
Sep 2, 2024
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ The agent captures the stacktraces of spans to help identify code paths that tri

The stacktrace is stored in the [`code.stacktrace`](https://opentelemetry.io/docs/specs/semconv/attributes-registry/code/) attribute.

The minimum span duration can be configured with `elastic.otel.span.stack.trace.min.duration` (in milliseconds, defaults to 5ms).
The minimum span duration can be configured with `elastic.otel.java.span-stacktrace.min.duration` (defaults to `5ms`).

Implementation has been contributed upstream in the [opentelemetry-java-contrib](https://github.com/open-telemetry/opentelemetry-java-contrib) repository,
in the [`span-stacktrace`](https://github.com/open-telemetry/opentelemetry-java-contrib/tree/main/span-stacktrace) folder.

### Runtime metrics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
@AutoService(ChainingSpanProcessorAutoConfiguration.class)
public class SpanStackTraceProcessorAutoConfig implements ChainingSpanProcessorAutoConfiguration {

static final String MIN_DURATION_CONFIG_OPTION = "elastic.otel.span.stack.trace.min.duration";
// TODO replace this with upstream config once it's stable
static final String MIN_DURATION_CONFIG_OPTION = "elastic.otel.java.span-stacktrace.min.duration";

@Override
public void registerSpanProcessors(
Expand Down
2 changes: 1 addition & 1 deletion docs/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ EDOT Java includes several OpenTelemetry extensions from the [OpenTelemetry Java
|---|---|---|
| `OTEL_SERVICE_NAME` | [Resource providers](https://github.com/open-telemetry/opentelemetry-java-contrib/tree/main/resource-providers) | This can be [set as usual](https://opentelemetry.io/docs/languages/sdk-configuration/general/#otel_service_name), but if not set the value will be inferred when the EDOT Java agent is running in various application servers. |
| `OTEL_INFERRED_SPANS_*` | [Inferred Spans](https://github.com/open-telemetry/opentelemetry-java-contrib/tree/main/inferred-spans) | Generates additional spans using profiling instead of instrumentation. |
| `OTEL_SPAN_STACK_TRACE_MIN_DURATION` | [Span stacktrace capture](https://github.com/open-telemetry/opentelemetry-java-contrib/tree/main/span-stacktrace) | Define the minimum duration (in milliseconds) for attaching stack traces to spans. Defaults to 5ms. |

### Configuration options that are _only_ available in EDOT Java

Expand All @@ -110,6 +109,7 @@ _Currently there are no additional `OTEL_` options waiting to be contributed ups
| Option(s) | Extension | Description |
|---|---|---|
| `ELASTIC_OTEL_UNIVERSAL_PROFILING_INTEGRATION_*` | [Universal profiling integration](https://github.com/elastic/elastic-otel-java/tree/main/universal-profiling-integration) | Correlates traces with profiling data from the Elastic universal profiler. |
| `ELASTIC_OTEL_JAVA_SPAN_STACKTRACE_MIN_DURATION` | [Span stacktrace capture](https://github.com/open-telemetry/opentelemetry-java-contrib/tree/main/span-stacktrace) | Define the minimum duration for attaching stack traces to spans. Defaults to 5ms. |

<!-- ✅ List auth methods -->
## Authentication methods
Expand Down
3 changes: 1 addition & 2 deletions inferred-spans/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ SdkTracerProvider tracerProvider = SdkTracerProvider.builder()
.addSpanProcessor(BatchSpanProcessor.builder(OtlpGrpcSpanExporter.builder()
.setEndpoint("https://<clusterid>.apm.europe-west3.gcp.cloud.es.io:443")
.addHeader("Authorization", "Bearer <secrettoken>>")
.build()))
.build();
.build())).build();
inferredSpans.setTracerProvider(tracerProvider);
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AgentFeaturesSmokeTest extends TestAppSmokeTest {
@BeforeAll
public static void start() {
startTestApp(
(container) -> container.addEnv("ELASTIC_OTEL_SPAN_STACK_TRACE_MIN_DURATION", "0ms"));
(container) -> container.addEnv("ELASTIC_OTEL_JAVA_SPAN_STACKTRACE_MIN_DURATION", "0ms"));
}

@AfterAll
Expand Down
Loading