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

Rename otel.config.file to otel.experimental.config.file #6396

Merged
merged 2 commits into from
Apr 18, 2024
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
6 changes: 3 additions & 3 deletions sdk-extensions/autoconfigure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ and [file configuration](https://github.com/open-telemetry/opentelemetry-specifi
To use, include `io.opentelemetry:opentelemetry-sdk-extension:incubator:<version>` and specify the
path to the config file as described in the table below.

| System property | Environment variable | Purpose |
|------------------|----------------------|------------------------------------------------------------|
| otel.config.file | OTEL_CONFIG_FILE | The path to the SDK configuration file. Defaults to unset. |
| System property | Environment variable | Purpose |
|-------------------------------|-------------------------------|------------------------------------------------------------|
| otel.experimental.config.file | OTEL_EXPERIMENTAL_CONFIG_FILE | The path to the SDK configuration file. Defaults to unset. |

NOTE: When a config file is specified, other environment variables described in this document along
with SPI [customizations](#customizing-the-opentelemetry-sdk) are ignored. The contents of the file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,12 @@

@Nullable
private static AutoConfiguredOpenTelemetrySdk maybeConfigureFromFile(ConfigProperties config) {
String configurationFile = config.getString("otel.config.file");
String otelConfigFile = config.getString("otel.config.file");
if (otelConfigFile != null && !otelConfigFile.isEmpty()) {
logger.warning(

Check warning on line 532 in sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java

View check run for this annotation

Codecov / codecov/patch

sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java#L532

Added line #L532 was not covered by tests
"otel.config.file was set, but has been replaced with otel.experimental.config.file");
}
String configurationFile = config.getString("otel.experimental.config.file");
jack-berg marked this conversation as resolved.
Show resolved Hide resolved
if (configurationFile == null || configurationFile.isEmpty()) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void configFile(@TempDir Path tempDir) throws IOException {
Files.write(path, yaml.getBytes(StandardCharsets.UTF_8));
ConfigProperties config =
DefaultConfigProperties.createFromMap(
Collections.singletonMap("otel.config.file", path.toString()));
Collections.singletonMap("otel.experimental.config.file", path.toString()));

assertThatThrownBy(() -> AutoConfiguredOpenTelemetrySdk.builder().setConfig(config).build())
.isInstanceOf(ConfigurationException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void setup() throws IOException {
void configFile_Valid() {
ConfigProperties config =
DefaultConfigProperties.createFromMap(
Collections.singletonMap("otel.config.file", configFilePath.toString()));
Collections.singletonMap("otel.experimental.config.file", configFilePath.toString()));
OpenTelemetrySdk expectedSdk =
OpenTelemetrySdk.builder()
.setTracerProvider(
Expand Down Expand Up @@ -116,7 +116,7 @@ void configFile_Valid() {
void configFile_NoShutdownHook() {
ConfigProperties config =
DefaultConfigProperties.createFromMap(
Collections.singletonMap("otel.config.file", configFilePath.toString()));
Collections.singletonMap("otel.experimental.config.file", configFilePath.toString()));
AutoConfiguredOpenTelemetrySdkBuilder builder = spy(AutoConfiguredOpenTelemetrySdk.builder());

AutoConfiguredOpenTelemetrySdk autoConfiguredOpenTelemetrySdk =
Expand All @@ -131,7 +131,7 @@ void configFile_setResultAsGlobalFalse() {
GlobalOpenTelemetry.set(OpenTelemetry.noop());
ConfigProperties config =
DefaultConfigProperties.createFromMap(
Collections.singletonMap("otel.config.file", configFilePath.toString()));
Collections.singletonMap("otel.experimental.config.file", configFilePath.toString()));

AutoConfiguredOpenTelemetrySdk autoConfiguredOpenTelemetrySdk =
AutoConfiguredOpenTelemetrySdk.builder().setConfig(config).build();
Expand All @@ -147,7 +147,7 @@ void configFile_setResultAsGlobalFalse() {
void configFile_setResultAsGlobalTrue() {
ConfigProperties config =
DefaultConfigProperties.createFromMap(
Collections.singletonMap("otel.config.file", configFilePath.toString()));
Collections.singletonMap("otel.experimental.config.file", configFilePath.toString()));

AutoConfiguredOpenTelemetrySdk autoConfiguredOpenTelemetrySdk =
AutoConfiguredOpenTelemetrySdk.builder().setConfig(config).setResultAsGlobal().build();
Expand Down Expand Up @@ -177,7 +177,7 @@ void configFile_Error(@TempDir Path tempDir) throws IOException {
Files.write(path, yaml.getBytes(StandardCharsets.UTF_8));
ConfigProperties config =
DefaultConfigProperties.createFromMap(
Collections.singletonMap("otel.config.file", path.toString()));
Collections.singletonMap("otel.experimental.config.file", path.toString()));

assertThatThrownBy(() -> AutoConfiguredOpenTelemetrySdk.builder().setConfig(config).build())
.isInstanceOf(ConfigurationException.class)
Expand Down
2 changes: 1 addition & 1 deletion sdk-extensions/incubator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ try (FileInputStream yamlConfigFileInputStream = new FileInputStream("/path/to/c
Notes:
* Environment variable substitution is supported as [defined in the spec](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/file-configuration.md#environment-variable-substitution)
* Currently, there is no support for the SPIs defined in [opentelemetry-sdk-extension-autoconfigure-spi](../autoconfigure-spi). Only built in samplers, processors, exporters, etc can be configured.
* You can use file configuration with [autoconfigure](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#file-configuration) to specify a configuration file via environment variable, e.g. `OTEL_CONFIG_FILE=/path/to/config.yaml`.
* You can use file configuration with [autoconfigure](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#file-configuration) to specify a configuration file via environment variable, e.g. `OTEL_EXPERIMENTAL_CONFIG_FILE=/path/to/config.yaml`.

## View File Configuration

Expand Down
Loading