Skip to content

Commit

Permalink
Refactor java instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg committed Oct 1, 2024
1 parent 34a1a76 commit fe3100a
Show file tree
Hide file tree
Showing 10 changed files with 2,073 additions and 1,215 deletions.
2 changes: 1 addition & 1 deletion content/en/docs/collector/deployment/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Cons:
[instrumentation]: /docs/languages/
[otlp]: /docs/specs/otel/protocol/
[collector]: /docs/collector/
[instrument-java-metrics]: /docs/languages/java/instrumentation/#metrics
[instrument-java-metrics]: /docs/languages/java/api-components/#meterprovider
[otlp-exporter]: /docs/specs/otel/protocol/exporter/
[java-otlp-example]:
https://github.com/open-telemetry/opentelemetry-java-docs/tree/main/otlp
Expand Down
6 changes: 2 additions & 4 deletions content/en/docs/concepts/instrumentation/libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ After you create a span, pass new trace context to the application code
(callback or handler), by making the span active; if possible, do this
explicitly. The following Java example shows how to add trace context and
activate a span. See the
[Context extraction in Java](/docs/languages/java/instrumentation/#context-propagation),
[Context extraction in Java](/docs/languages/java/api-components/#contextpropagators),
for more examples.

```java
Expand All @@ -289,9 +289,7 @@ try (Scope unused = span.makeCurrent()) {
```

In the case of a messaging system, you might receive more than one message at
once. Received messages become
[links](/docs/languages/java/instrumentation/#create-spans-with-links) on the
span you create. Refer to
once. Received messages become links on the span you create. Refer to
[messaging conventions](/docs/specs/semconv/messaging/messaging-spans/) for
details.

Expand Down
1,691 changes: 1,691 additions & 0 deletions content/en/docs/languages/java/api-components.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions content/en/docs/languages/java/api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: API reference
linkTitle: API
title: Javadoc API reference
linkTitle: Javadoc
redirect: https://javadoc.io/doc/io.opentelemetry
manualLinkTarget: _blank
_build: { render: link }
Expand Down
64 changes: 32 additions & 32 deletions content/en/docs/languages/java/configuration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Configure the SDK
linkTitle: Configure the SDK
weight: 12
weight: 13
aliases: [config]
# prettier-ignore
cSpell:ignore: authservice autoconfigured blrp Customizer Dotel ignore LOWMEMORY myservice ottrace PKCS retryable tracepropagators
Expand All @@ -11,7 +11,7 @@ cSpell:ignore: authservice autoconfigured blrp Customizer Dotel ignore LOWMEMORY
<?code-excerpt path-base="examples/java/configuration"?>

The [SDK](../sdk/) is the built-in reference implementation of the
[API](../instrumentation/), processing and exporting telemetry produced by
[API](../api-components/), processing and exporting telemetry produced by
instrumentation API calls. Configuring the SDK to process and export
appropriately is an essential step to integrating OpenTelemetry into an
application.
Expand Down Expand Up @@ -361,36 +361,36 @@ import java.util.Collections;
public class CustomizedAutoConfiguredSdk {
public static OpenTelemetrySdk autoconfiguredSdk() {
return AutoConfiguredOpenTelemetrySdk.builder()
// Optionally customize TextMapPropagator.
.addPropagatorCustomizer((textMapPropagator, configProperties) -> textMapPropagator)
// Optionally customize Resource.
.addResourceCustomizer((resource, configProperties) -> resource)
// Optionally customize Sampler.
.addSamplerCustomizer((sampler, configProperties) -> sampler)
// Optionally customize SpanExporter.
.addSpanExporterCustomizer((spanExporter, configProperties) -> spanExporter)
// Optionally customize SpanProcessor.
.addSpanProcessorCustomizer((spanProcessor, configProperties) -> spanProcessor)
// Optionally supply additional properties.
.addPropertiesSupplier(Collections::emptyMap)
// Optionally customize ConfigProperties.
.addPropertiesCustomizer(configProperties -> Collections.emptyMap())
// Optionally customize SdkTracerProviderBuilder.
.addTracerProviderCustomizer((builder, configProperties) -> builder)
// Optionally customize SdkMeterProviderBuilder.
.addMeterProviderCustomizer((builder, configProperties) -> builder)
// Optionally customize MetricExporter.
.addMetricExporterCustomizer((metricExporter, configProperties) -> metricExporter)
// Optionally customize MetricReader.
.addMetricReaderCustomizer((metricReader, configProperties) -> metricReader)
// Optionally customize SdkLoggerProviderBuilder.
.addLoggerProviderCustomizer((builder, configProperties) -> builder)
// Optionally customize LogRecordExporter.
.addLogRecordExporterCustomizer((logRecordExporter, configProperties) -> logRecordExporter)
// Optionally customize LogRecordProcessor.
.addLogRecordProcessorCustomizer((processor, configProperties) -> processor)
.build()
.getOpenTelemetrySdk();
// Optionally customize TextMapPropagator.
.addPropagatorCustomizer((textMapPropagator, configProperties) -> textMapPropagator)
// Optionally customize Resource.
.addResourceCustomizer((resource, configProperties) -> resource)
// Optionally customize Sampler.
.addSamplerCustomizer((sampler, configProperties) -> sampler)
// Optionally customize SpanExporter.
.addSpanExporterCustomizer((spanExporter, configProperties) -> spanExporter)
// Optionally customize SpanProcessor.
.addSpanProcessorCustomizer((spanProcessor, configProperties) -> spanProcessor)
// Optionally supply additional properties.
.addPropertiesSupplier(Collections::emptyMap)
// Optionally customize ConfigProperties.
.addPropertiesCustomizer(configProperties -> Collections.emptyMap())
// Optionally customize SdkTracerProviderBuilder.
.addTracerProviderCustomizer((builder, configProperties) -> builder)
// Optionally customize SdkMeterProviderBuilder.
.addMeterProviderCustomizer((builder, configProperties) -> builder)
// Optionally customize MetricExporter.
.addMetricExporterCustomizer((metricExporter, configProperties) -> metricExporter)
// Optionally customize MetricReader.
.addMetricReaderCustomizer((metricReader, configProperties) -> metricReader)
// Optionally customize SdkLoggerProviderBuilder.
.addLoggerProviderCustomizer((builder, configProperties) -> builder)
// Optionally customize LogRecordExporter.
.addLogRecordExporterCustomizer((logRecordExporter, configProperties) -> logRecordExporter)
// Optionally customize LogRecordProcessor.
.addLogRecordProcessorCustomizer((processor, configProperties) -> processor)
.build()
.getOpenTelemetrySdk();
}
}
```
Expand Down
Loading

0 comments on commit fe3100a

Please sign in to comment.