Skip to content

Commit 4405988

Browse files
authored
Document java EnvironmentResourceProvider (#6100)
1 parent d4f11fc commit 4405988

File tree

1 file changed

+41
-32
lines changed

1 file changed

+41
-32
lines changed

content/en/docs/languages/java/configuration.md

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -138,23 +138,6 @@ Properties for disabling the [SDK](../sdk/#opentelemetrysdk):
138138
returns a minimally configured instance (for example,
139139
`OpenTelemetrySdk.builder().build()`).
140140

141-
Properties for configuring [resource](../sdk/#resource):
142-
143-
| System property | Description | Default |
144-
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
145-
| `otel.service.name` | Specify logical service name. Takes precedence over `service.name` defined with `otel.resource.attributes`. | `unknown_service:java` |
146-
| `otel.resource.attributes` | Specify resource attributes in the following format: `key1=val1,key2=val2,key3=val3`. | |
147-
| `otel.resource.disabled.keys` | Specify resource attribute keys to filter. | |
148-
| `otel.java.enabled.resource.providers` | Comma-separated list of `ResourceProvider` fully qualified class names to enable. **[1]** If unset, all resource providers are enabled. | |
149-
| `otel.java.disabled.resource.providers` | Comma-separated list of `ResourceProvider` fully qualified class names to disable. **[1]** | |
150-
151-
**[1]**: For example, to disable the
152-
[OS resource provider](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/resources/library/src/main/java/io/opentelemetry/instrumentation/resources/OsResourceProvider.java),
153-
set
154-
`-Dotel.java.disabled.resource.providers=io.opentelemetry.instrumentation.resources.OsResourceProvider`.
155-
See [ResourceProvider](#resourceprovider) for resource provider artifact
156-
coordinates.
157-
158141
Properties for attribute limits (see [span limits](../sdk/#spanlimits),
159142
[log limits](../sdk/#loglimits)):
160143

@@ -180,6 +163,31 @@ Properties for [context propagation](../sdk/#textmappropagator):
180163
- `xray` configures `AwsXrayPropagator`.
181164
- `xray-lambda` configures `AwsXrayLambdaPropagator`.
182165

166+
#### Properties: resource
167+
168+
Properties for configuring [resource](../sdk/#resource):
169+
170+
| System property | Description | Default |
171+
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
172+
| `otel.service.name` | Specify logical service name. Takes precedence over `service.name` defined with `otel.resource.attributes`. | `unknown_service:java` |
173+
| `otel.resource.attributes` | Specify resource attributes in the following format: `key1=val1,key2=val2,key3=val3`. | |
174+
| `otel.resource.disabled.keys` | Specify resource attribute keys to filter. | |
175+
| `otel.java.enabled.resource.providers` | Comma-separated list of `ResourceProvider` fully qualified class names to enable. **[1]** If unset, all resource providers are enabled. | |
176+
| `otel.java.disabled.resource.providers` | Comma-separated list of `ResourceProvider` fully qualified class names to disable. **[1]** | |
177+
178+
**[1]**: For example, to disable the
179+
[OS resource provider](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/resources/library/src/main/java/io/opentelemetry/instrumentation/resources/OsResourceProvider.java),
180+
set
181+
`-Dotel.java.disabled.resource.providers=io.opentelemetry.instrumentation.resources.OsResourceProvider`.
182+
183+
**NOTE**: The `otel.service.name` and `otel.resource.attributes` system
184+
properties / environment variables are interpreted in the
185+
`io.opentelemetry.sdk.autoconfigure.EnvironmentResourceProvider` resource
186+
provider. If opting in to specify resource providers via
187+
`otel.java.enabled.resource-providers`, you'll likely want to include it to
188+
avoid surprises. See [ResourceProvider](#resourceprovider) for resource provider
189+
artifact coordinates.
190+
183191
#### Properties: traces
184192

185193
Properties for [batch span processor(s)](../sdk/#spanprocessor) paired with
@@ -418,21 +426,22 @@ contribute to the autoconfigured [resource](../sdk/#resource).
418426
`ResourceProvider`s built-in to the SDK and maintained by the community in
419427
`opentelemetry-java-contrib`:
420428

421-
| Class | Artifact | Description |
422-
| ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
423-
| `io.opentelemetry.instrumentation.resources.ContainerResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides container resource attributes. |
424-
| `io.opentelemetry.instrumentation.resources.HostResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides host resource attributes. |
425-
| `io.opentelemetry.instrumentation.resources.HostIdResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides host ID resource attribute. |
426-
| `io.opentelemetry.instrumentation.resources.ManifestResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides service resource attributes based on jar manifest. |
427-
| `io.opentelemetry.instrumentation.resources.OsResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides OS resource attributes. |
428-
| `io.opentelemetry.instrumentation.resources.ProcessResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides process resource attributes. |
429-
| `io.opentelemetry.instrumentation.resources.ProcessRuntimeProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides process runtime resource attributes. |
430-
| `io.opentelemetry.contrib.gcp.resource.GCPResourceProvider` | `io.opentelemetry.contrib:opentelemetry-gcp-resources:{{% param vers.contrib %}}-alpha` | Provides GCP runtime environment resource attributes. |
431-
| `io.opentelemetry.contrib.aws.resource.BeanstalkResourceProvider` | `io.opentelemetry.contrib:opentelemetry-aws-resources:{{% param vers.contrib %}}-alpha` | Provides AWS beanstalk runtime environment resource attributes. |
432-
| `io.opentelemetry.contrib.aws.resource.Ec2ResourceProvider` | `io.opentelemetry.contrib:opentelemetry-aws-resources:{{% param vers.contrib %}}-alpha` | Provides AWS ec2 runtime environment resource attributes. |
433-
| `io.opentelemetry.contrib.aws.resource.EcsResourceProvider` | `io.opentelemetry.contrib:opentelemetry-aws-resources:{{% param vers.contrib %}}-alpha` | Provides AWS ecs runtime environment resource attributes. |
434-
| `io.opentelemetry.contrib.aws.resource.EksResourceProvider` | `io.opentelemetry.contrib:opentelemetry-aws-resources:{{% param vers.contrib %}}-alpha` | Provides AWS eks runtime environment resource attributes. |
435-
| `io.opentelemetry.contrib.aws.resource.LambdaResourceProvider` | `io.opentelemetry.contrib:opentelemetry-aws-resources:{{% param vers.contrib %}}-alpha` | Provides AWS lambda runtime environment resource attributes. |
429+
| Class | Artifact | Description |
430+
| ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
431+
| `io.opentelemetry.sdk.autoconfigure.internal.EnvironmentResourceProvider` | `io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:{{% param vers.otel %}}` | Provides resource attributes based on `OTEL_SERVICE_NAME` and `OTEL_RESOURCE_ATTRIBUTES` env vars. |
432+
| `io.opentelemetry.instrumentation.resources.ContainerResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides container resource attributes. |
433+
| `io.opentelemetry.instrumentation.resources.HostResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides host resource attributes. |
434+
| `io.opentelemetry.instrumentation.resources.HostIdResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides host ID resource attribute. |
435+
| `io.opentelemetry.instrumentation.resources.ManifestResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides service resource attributes based on jar manifest. |
436+
| `io.opentelemetry.instrumentation.resources.OsResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides OS resource attributes. |
437+
| `io.opentelemetry.instrumentation.resources.ProcessResourceProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides process resource attributes. |
438+
| `io.opentelemetry.instrumentation.resources.ProcessRuntimeProvider` | `io.opentelemetry.instrumentation:opentelemetry-resources:{{% param vers.instrumentation %}}-alpha` | Provides process runtime resource attributes. |
439+
| `io.opentelemetry.contrib.gcp.resource.GCPResourceProvider` | `io.opentelemetry.contrib:opentelemetry-gcp-resources:{{% param vers.contrib %}}-alpha` | Provides GCP runtime environment resource attributes. |
440+
| `io.opentelemetry.contrib.aws.resource.BeanstalkResourceProvider` | `io.opentelemetry.contrib:opentelemetry-aws-resources:{{% param vers.contrib %}}-alpha` | Provides AWS beanstalk runtime environment resource attributes. |
441+
| `io.opentelemetry.contrib.aws.resource.Ec2ResourceProvider` | `io.opentelemetry.contrib:opentelemetry-aws-resources:{{% param vers.contrib %}}-alpha` | Provides AWS ec2 runtime environment resource attributes. |
442+
| `io.opentelemetry.contrib.aws.resource.EcsResourceProvider` | `io.opentelemetry.contrib:opentelemetry-aws-resources:{{% param vers.contrib %}}-alpha` | Provides AWS ecs runtime environment resource attributes. |
443+
| `io.opentelemetry.contrib.aws.resource.EksResourceProvider` | `io.opentelemetry.contrib:opentelemetry-aws-resources:{{% param vers.contrib %}}-alpha` | Provides AWS eks runtime environment resource attributes. |
444+
| `io.opentelemetry.contrib.aws.resource.LambdaResourceProvider` | `io.opentelemetry.contrib:opentelemetry-aws-resources:{{% param vers.contrib %}}-alpha` | Provides AWS lambda runtime environment resource attributes. |
436445

437446
Implement the `ResourceProvider` interface to participate in resource
438447
autoconfiguration. For example:

0 commit comments

Comments
 (0)