-
Notifications
You must be signed in to change notification settings - Fork 831
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add public API to access environment resource (#5554)
- Loading branch information
Showing
5 changed files
with
108 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...rc/main/java/io/opentelemetry/sdk/autoconfigure/internal/EnvironmentResourceProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.autoconfigure.internal; | ||
|
||
import io.opentelemetry.sdk.autoconfigure.ResourceConfiguration; | ||
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; | ||
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider; | ||
import io.opentelemetry.sdk.resources.Resource; | ||
|
||
/** | ||
* {@link ResourceProvider} for automatically configuring {@link | ||
* ResourceConfiguration#createEnvironmentResource(ConfigProperties)}. | ||
*/ | ||
public final class EnvironmentResourceProvider implements ResourceProvider { | ||
@Override | ||
public Resource createResource(ConfigProperties config) { | ||
return ResourceConfiguration.createEnvironmentResource(config); | ||
} | ||
|
||
@Override | ||
public int order() { | ||
// Environment resource takes precedent over all other ResourceProviders | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
.../main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.opentelemetry.sdk.autoconfigure.internal.EnvironmentResourceProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters