Skip to content

Commit

Permalink
update smp configs name with backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
srprash committed Feb 9, 2024
1 parent 0bb89bd commit 93f14b2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ metadata:
namespace: default # use a namespace with pods you'd like to inject
spec:
exporter:
endpoint: http://cloudwatch-agent.amazon-cloudwatch:4317
endpoint: http://cloudwatch-agent.amazon-cloudwatch:4315
propagators:
- tracecontext
- baggage
Expand All @@ -134,8 +134,10 @@ spec:
env:
- name: OTEL_METRICS_EXPORTER
value: "none"
- name: OTEL_SMP_ENABLED
- name: OTEL_AWS_APP_SIGNALS_ENABLED
value: "true"
- name: OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT
value: "http://cloudwatch-agent.amazon-cloudwatch:4315"
EOF
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"OTEL_SMP_ENABLED": "true",
"OTEL_AWS_APP_SIGNALS_ENABLED": "true",
"OTEL_TRACES_SAMPLER_ARG": "endpoint=http://cloudwatch-agent.amazon-cloudwatch:2000",
"OTEL_TRACES_SAMPLER": "xray",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "http://cloudwatch-agent.amazon-cloudwatch:4316/v1/traces",
"OTEL_AWS_SMP_EXPORTER_ENDPOINT": "http://cloudwatch-agent.amazon-cloudwatch:4315",
"OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT": "http://cloudwatch-agent.amazon-cloudwatch:4315",
"OTEL_METRICS_EXPORTER": "none",
"JAVA_TOOL_OPTIONS": "-javaagent:/otel-auto-instrumentation-java/javaagent.jar"
}
22 changes: 14 additions & 8 deletions pkg/instrumentation/defaultinstrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const (
defaultNamespace = "default"
defaultKind = "Instrumentation"

otelSampleEnabledKey = "OTEL_SMP_ENABLED"
otelSampleEnabledDefaultValue = "true"
otelSampleEnabledKey = "OTEL_SMP_ENABLED" //TODO: remove in favor of new name once safe
otelSampleEnabledDefaultValue = "true" //TODO: remove in favor of new name once safe
otelAppSignalsEnabledKey = "OTEL_AWS_APP_SIGNALS_ENABLED"
otelAppSignalsEnabledDefaultValue = "true"
otelTracesSamplerArgKey = "OTEL_TRACES_SAMPLER_ARG"
otelTracesSamplerArgDefaultValue = "endpoint=http://cloudwatch-agent.amazon-cloudwatch:2000"
otelTracesSamplerKey = "OTEL_TRACES_SAMPLER"
Expand All @@ -29,8 +31,10 @@ const (
otelExporterOtlpProtocolValue = "http/protobuf"
otelExporterTracesEndpointKey = "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"
otelExporterTracesEndpointDefaultValue = "http://cloudwatch-agent.amazon-cloudwatch:4316/v1/traces"
otelExporterSmpEndpointKey = "OTEL_AWS_SMP_EXPORTER_ENDPOINT"
otelExporterSmpEndpointDefaultValue = "http://cloudwatch-agent.amazon-cloudwatch:4315"
otelExporterSmpEndpointKey = "OTEL_AWS_SMP_EXPORTER_ENDPOINT" //TODO: remove in favor of new name once safe
otelExporterSmpEndpointDefaultValue = "http://cloudwatch-agent.amazon-cloudwatch:4315" //TODO: remove in favor of new name once safe
otelExporterAppSignalsEndpointKey = "OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT"
otelExporterAppSignalsEndpointDefaultValue = "http://cloudwatch-agent.amazon-cloudwatch:4315"
otelExporterMetricKey = "OTEL_METRICS_EXPORTER"
otelExporterMetricDefaultValue = "none"

Expand Down Expand Up @@ -70,23 +74,25 @@ func getDefaultInstrumentation() (*v1alpha1.Instrumentation, error) {
Java: v1alpha1.Java{
Image: javaInstrumentationImage,
Env: []corev1.EnvVar{
{Name: otelSampleEnabledKey, Value: otelSampleEnabledDefaultValue},
{Name: otelSampleEnabledKey, Value: otelSampleEnabledDefaultValue}, //TODO: remove in favor of new name once safe
{Name: otelAppSignalsEnabledKey, Value: otelAppSignalsEnabledDefaultValue},
{Name: otelTracesSamplerArgKey, Value: otelTracesSamplerArgDefaultValue},
{Name: otelTracesSamplerKey, Value: otelTracesSamplerDefaultValue},
{Name: otelExporterOtlpProtocolKey, Value: otelExporterOtlpProtocolValue},
{Name: otelExporterTracesEndpointKey, Value: otelExporterTracesEndpointDefaultValue},
{Name: otelExporterSmpEndpointKey, Value: otelExporterSmpEndpointDefaultValue},
{Name: otelExporterSmpEndpointKey, Value: otelExporterSmpEndpointDefaultValue}, //TODO: remove in favor of new name once safe
{Name: otelExporterAppSignalsEndpointKey, Value: otelExporterAppSignalsEndpointDefaultValue},
{Name: otelExporterMetricKey, Value: otelExporterMetricDefaultValue},
},
},
Python: v1alpha1.Python{
Image: pythonInstrumentationImage,
Env: []corev1.EnvVar{
{Name: otelSampleEnabledKey, Value: otelSampleEnabledDefaultValue},
{Name: otelAppSignalsEnabledKey, Value: otelAppSignalsEnabledDefaultValue},
{Name: otelTracesSamplerArgKey, Value: otelTracesSamplerArgDefaultValue},
{Name: otelExporterOtlpProtocolKey, Value: otelExporterOtlpProtocolValue},
{Name: otelExporterTracesEndpointKey, Value: otelExporterTracesEndpointDefaultValue},
{Name: otelExporterSmpEndpointKey, Value: otelExporterSmpEndpointDefaultValue},
{Name: otelExporterAppSignalsEndpointKey, Value: otelExporterAppSignalsEndpointDefaultValue},
{Name: otelExporterMetricKey, Value: otelExporterMetricDefaultValue},
{Name: otelPythonDistro, Value: otelPythonDistroDefaultValue},
{Name: otelPythonConfigurator, Value: otelPythonConfiguratorDefaultValue},
Expand Down
10 changes: 6 additions & 4 deletions pkg/instrumentation/podmutator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,25 @@ func TestGetInstrumentationInstanceFromNameSpaceDefault(t *testing.T) {
Java: v1alpha1.Java{
Image: defaultJavaInstrumentationImage,
Env: []corev1.EnvVar{
{Name: otelSampleEnabledKey, Value: otelSampleEnabledDefaultValue},
{Name: otelSampleEnabledKey, Value: otelSampleEnabledDefaultValue}, //TODO: remove in favor of new name once safe
{Name: otelAppSignalsEnabledKey, Value: otelAppSignalsEnabledDefaultValue},
{Name: otelTracesSamplerArgKey, Value: otelTracesSamplerArgDefaultValue},
{Name: otelTracesSamplerKey, Value: otelTracesSamplerDefaultValue},
{Name: otelExporterOtlpProtocolKey, Value: otelExporterOtlpProtocolValue},
{Name: otelExporterTracesEndpointKey, Value: otelExporterTracesEndpointDefaultValue},
{Name: otelExporterSmpEndpointKey, Value: otelExporterSmpEndpointDefaultValue},
{Name: otelExporterSmpEndpointKey, Value: otelExporterSmpEndpointDefaultValue}, //TODO: remove in favor of new name once safe
{Name: otelExporterAppSignalsEndpointKey, Value: otelExporterAppSignalsEndpointDefaultValue},
{Name: otelExporterMetricKey, Value: otelExporterMetricDefaultValue},
},
},
Python: v1alpha1.Python{
Image: defaultPythonInstrumentationImage,
Env: []corev1.EnvVar{
{Name: otelSampleEnabledKey, Value: otelSampleEnabledDefaultValue},
{Name: otelAppSignalsEnabledKey, Value: otelAppSignalsEnabledDefaultValue},
{Name: otelTracesSamplerArgKey, Value: otelTracesSamplerArgDefaultValue},
{Name: otelExporterOtlpProtocolKey, Value: otelExporterOtlpProtocolValue},
{Name: otelExporterTracesEndpointKey, Value: otelExporterTracesEndpointDefaultValue},
{Name: otelExporterSmpEndpointKey, Value: otelExporterSmpEndpointDefaultValue},
{Name: otelExporterAppSignalsEndpointKey, Value: otelExporterAppSignalsEndpointDefaultValue},
{Name: otelExporterMetricKey, Value: otelExporterMetricDefaultValue},
{Name: otelPythonDistro, Value: otelPythonDistroDefaultValue},
{Name: otelPythonConfigurator, Value: otelPythonConfiguratorDefaultValue},
Expand Down

0 comments on commit 93f14b2

Please sign in to comment.