Skip to content

Commit

Permalink
Rename AppSignals configs with backward compatibility (#744)
Browse files Browse the repository at this point in the history
* Rename AppSignals configs with backwards compatibility

* update config name in contract tests

* fixing related javadoc
  • Loading branch information
srprash authored Feb 13, 2024
1 parent 757e2ef commit 61460af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ public abstract class ContractTestBase {
.waitingFor(getApplicationWaitCondition())
.withEnv("JAVA_TOOL_OPTIONS", "-javaagent:/opentelemetry-javaagent-all.jar")
.withEnv("OTEL_METRIC_EXPORT_INTERVAL", "100") // 100 ms
.withEnv("OTEL_SMP_ENABLED", "true")
.withEnv("OTEL_AWS_APP_SIGNALS_ENABLED", "true")
.withEnv("OTEL_METRICS_EXPORTER", "none")
.withEnv("OTEL_BSP_SCHEDULE_DELAY", "0") // Don't wait to export spans to the collector
.withEnv(
"OTEL_AWS_SMP_EXPORTER_ENDPOINT",
"OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT",
"http://" + COLLECTOR_HOSTNAME + ":" + COLLECTOR_PORT)
.withEnv(
"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
* <li>Add AwsMetricAttributesSpanExporter to add more attributes to all spans.
* </ul>
*
* <p>You can control when these customizations are applied using the property otel.smp.enabled or
* the environment variable OTEL_SMP_ENABLED. This flag is enabled by default.
* <p>You can control when these customizations are applied using the property
* otel.aws.app.signals.enabled or the environment variable OTEL_AWS_APP_SIGNALS_ENABLED. This flag
* is disabled by default.
*/
public class AwsAppSignalsCustomizerProvider implements AutoConfigurationCustomizerProvider {
private static final Duration DEFAULT_METRIC_EXPORT_INTERVAL = Duration.ofMinutes(1);
Expand All @@ -63,7 +64,8 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) {
}

private boolean isSmpEnabled(ConfigProperties configProps) {
return configProps.getBoolean("otel.smp.enabled", false);
return configProps.getBoolean(
"otel.aws.app.signals.enabled", configProps.getBoolean("otel.smp.enabled", false));
}

private Sampler customizeSampler(Sampler sampler, ConfigProperties configProps) {
Expand All @@ -79,7 +81,8 @@ private SdkTracerProviderBuilder customizeTracerProviderBuilder(
logger.info("Span Metrics Processor enabled");
String smpEndpoint =
configProps.getString(
"otel.aws.smp.exporter.endpoint", "http://cloudwatch-agent.amazon-cloudwatch:4317");
"otel.aws.app.signals.exporter.endpoint",
configProps.getString("otel.aws.smp.exporter.endpoint", "http://localhost:4315"));
Duration exportInterval =
configProps.getDuration("otel.metric.export.interval", DEFAULT_METRIC_EXPORT_INTERVAL);
logger.log(Level.FINE, String.format("Span Metrics endpoint: %s", smpEndpoint));
Expand Down

0 comments on commit 61460af

Please sign in to comment.