Skip to content

Commit c277a41

Browse files
authored
Supporting JMX annotations (#240)
1 parent 377104f commit c277a41

File tree

10 files changed

+529
-77
lines changed

10 files changed

+529
-77
lines changed

internal/manifests/collector/adapters/config_from.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type Traces struct {
5858
type MetricsCollected struct {
5959
StatsD *statsD `json:"statsd,omitempty"`
6060
CollectD *collectD `json:"collectd,omitempty"`
61+
JMX *jmx `json:"jmx,omitempty"`
6162
}
6263

6364
type LogMetricsCollected struct {
@@ -86,9 +87,13 @@ type AppSignals struct {
8687

8788
type emf struct {
8889
}
90+
91+
type jmx struct{}
92+
8993
type kubernetes struct {
9094
EnhancedContainerInsights bool `json:"enhanced_container_insights,omitempty"`
9195
AcceleratedComputeMetrics bool `json:"accelerated_compute_metrics,omitempty"`
96+
JMXContainerInsights bool `json:"jmx_container_insights,omitempty"`
9297
}
9398

9499
type xray struct {

internal/manifests/collector/ports.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ const (
3737
EMFTcp = "emf-tcp"
3838
EMFUdp = "emf-udp"
3939
CWA = "cwa-"
40+
JmxHttp = "jmx-http"
4041
)
4142

4243
var receiverDefaultPortsMap = map[string]int32{
4344
StatsD: 8125,
4445
CollectD: 25826,
4546
XrayTraces: 2000,
47+
JmxHttp: 4314,
4648
OtlpGrpc: 4317,
4749
OtlpHttp: 4318,
4850
EMF: 25888,
@@ -143,6 +145,9 @@ func getMetricsReceiversServicePorts(logger logr.Logger, config *adapters.CwaCon
143145
if config.Metrics.MetricsCollected.CollectD != nil {
144146
getReceiverServicePort(logger, config.Metrics.MetricsCollected.CollectD.ServiceAddress, CollectD, corev1.ProtocolUDP, servicePortsMap)
145147
}
148+
if config.Metrics.MetricsCollected.JMX != nil {
149+
getReceiverServicePort(logger, "", JmxHttp, corev1.ProtocolTCP, servicePortsMap)
150+
}
146151
}
147152

148153
func getReceiverServicePort(logger logr.Logger, serviceAddress string, receiverName string, protocol corev1.Protocol, servicePortsMap map[int32][]corev1.ServicePort) {
@@ -195,6 +200,20 @@ func getLogsReceiversServicePorts(logger logr.Logger, config *adapters.CwaConfig
195200
servicePortsMap[receiverDefaultPortsMap[EMF]] = []corev1.ServicePort{tcp, udp}
196201
}
197202
}
203+
204+
//JMX Container Insights
205+
if config.Logs != nil && config.Logs.LogMetricsCollected != nil && config.Logs.LogMetricsCollected.Kubernetes != nil && config.Logs.LogMetricsCollected.Kubernetes.JMXContainerInsights {
206+
if _, ok := servicePortsMap[receiverDefaultPortsMap[JmxHttp]]; ok {
207+
logger.Info("Duplicate port has been configured in Agent Config for port", zap.Int32("port", receiverDefaultPortsMap[JmxHttp]))
208+
} else {
209+
tcp := corev1.ServicePort{
210+
Name: JmxHttp,
211+
Port: receiverDefaultPortsMap[JmxHttp],
212+
Protocol: corev1.ProtocolTCP,
213+
}
214+
servicePortsMap[receiverDefaultPortsMap[JmxHttp]] = []corev1.ServicePort{tcp}
215+
}
216+
}
198217
}
199218

200219
func getTracesReceiversServicePorts(logger logr.Logger, config *adapters.CwaConfig, servicePortsMap map[int32][]corev1.ServicePort) []corev1.ServicePort {

internal/manifests/collector/ports_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,24 @@ func TestInvalidConfigGetContainerPorts(t *testing.T) {
204204

205205
}
206206

207+
func TestJMXGetContainerPorts(t *testing.T) {
208+
cfg := getJSONStringFromFile("./test-resources/jmxAgentConfig.json")
209+
containerPorts := getContainerPorts(logger, cfg, []corev1.ServicePort{})
210+
assert.Equal(t, 1, len(containerPorts))
211+
assert.Equal(t, int32(4314), containerPorts[JmxHttp].ContainerPort)
212+
assert.Equal(t, JmxHttp, containerPorts[JmxHttp].Name)
213+
assert.Equal(t, corev1.ProtocolTCP, containerPorts[JmxHttp].Protocol)
214+
}
215+
216+
func TestJMXContainerInsightsGetContainerPorts(t *testing.T) {
217+
cfg := getJSONStringFromFile("./test-resources/jmxContainerInsightsConfig.json")
218+
containerPorts := getContainerPorts(logger, cfg, []corev1.ServicePort{})
219+
assert.Equal(t, 1, len(containerPorts))
220+
assert.Equal(t, int32(4314), containerPorts[JmxHttp].ContainerPort)
221+
assert.Equal(t, JmxHttp, containerPorts[JmxHttp].Name)
222+
assert.Equal(t, corev1.ProtocolTCP, containerPorts[JmxHttp].Protocol)
223+
}
224+
207225
func getJSONStringFromFile(path string) string {
208226
buf, err := os.ReadFile(path)
209227
if err != nil {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"metrics": {
3+
"metrics_collected": {
4+
"jmx": {
5+
}
6+
}
7+
}
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"logs": {
3+
"metrics_collected": {
4+
"kubernetes": {
5+
"cluster_name": "TestCluster",
6+
"jmx_container_insights": true
7+
}
8+
}
9+
}
10+
}

pkg/instrumentation/defaultinstrumentation.go

Lines changed: 107 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import (
88
"fmt"
99
"os"
1010

11-
"k8s.io/apimachinery/pkg/api/resource"
12-
1311
corev1 "k8s.io/api/core/v1"
12+
"k8s.io/apimachinery/pkg/api/resource"
1413
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1514

1615
"github.com/aws/amazon-cloudwatch-agent-operator/apis/v1alpha1"
1716
"github.com/aws/amazon-cloudwatch-agent-operator/internal/manifests/collector/adapters"
17+
"github.com/aws/amazon-cloudwatch-agent-operator/pkg/instrumentation/jmx"
1818
)
1919

2020
const (
@@ -50,7 +50,7 @@ func getInstrumentationConfigForResource(langStr string, resourceStr string) cor
5050
return instrumentationConfigForResource
5151
}
5252

53-
func getDefaultInstrumentation(agentConfig *adapters.CwaConfig, isWindowsPod bool) (*v1alpha1.Instrumentation, error) {
53+
func getDefaultInstrumentation(agentConfig *adapters.CwaConfig, additionalEnvs map[Type]map[string]string, isWindowsPod bool) (*v1alpha1.Instrumentation, error) {
5454
javaInstrumentationImage, ok := os.LookupEnv("AUTO_INSTRUMENTATION_JAVA")
5555
if !ok {
5656
return nil, errors.New("unable to determine java instrumentation image")
@@ -77,9 +77,10 @@ func getDefaultInstrumentation(agentConfig *adapters.CwaConfig, isWindowsPod boo
7777

7878
// set protocol by checking cloudwatch agent config for tls setting
7979
exporterPrefix := http
80-
if agentConfig != nil {
81-
appSignalsConfig := agentConfig.GetApplicationSignalsConfig()
82-
if appSignalsConfig != nil && appSignalsConfig.TLS != nil {
80+
isApplicationSignalsEnabled := agentConfig != nil && agentConfig.GetApplicationSignalsConfig() != nil
81+
82+
if isApplicationSignalsEnabled {
83+
if agentConfig.GetApplicationSignalsConfig().TLS != nil {
8384
exporterPrefix = https
8485
}
8586
}
@@ -103,77 +104,31 @@ func getDefaultInstrumentation(agentConfig *adapters.CwaConfig, isWindowsPod boo
103104
},
104105
Java: v1alpha1.Java{
105106
Image: javaInstrumentationImage,
106-
Env: []corev1.EnvVar{
107-
{Name: "OTEL_AWS_APP_SIGNALS_ENABLED", Value: "true"}, //TODO: remove in favor of new name once safe
108-
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"},
109-
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", http, cloudwatchAgentServiceEndpoint)},
110-
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"},
111-
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"},
112-
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)},
113-
{Name: "OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)}, //TODO: remove in favor of new name once safe
114-
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)},
115-
{Name: "OTEL_METRICS_EXPORTER", Value: "none"},
116-
{Name: "OTEL_LOGS_EXPORTER", Value: "none"},
117-
},
107+
Env: getJavaEnvs(isApplicationSignalsEnabled, cloudwatchAgentServiceEndpoint, exporterPrefix, additionalEnvs[TypeJava]),
118108
Resources: corev1.ResourceRequirements{
119109
Limits: getInstrumentationConfigForResource(java, limit),
120110
Requests: getInstrumentationConfigForResource(java, request),
121111
},
122112
},
123113
Python: v1alpha1.Python{
124114
Image: pythonInstrumentationImage,
125-
Env: []corev1.EnvVar{
126-
{Name: "OTEL_AWS_APP_SIGNALS_ENABLED", Value: "true"}, //TODO: remove in favor of new name once safe
127-
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"},
128-
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", http, cloudwatchAgentServiceEndpoint)},
129-
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"},
130-
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"},
131-
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)},
132-
{Name: "OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)}, //TODO: remove in favor of new name once safe
133-
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)},
134-
{Name: "OTEL_METRICS_EXPORTER", Value: "none"},
135-
{Name: "OTEL_PYTHON_DISTRO", Value: "aws_distro"},
136-
{Name: "OTEL_PYTHON_CONFIGURATOR", Value: "aws_configurator"},
137-
{Name: "OTEL_LOGS_EXPORTER", Value: "none"},
138-
},
115+
Env: getPythonEnvs(isApplicationSignalsEnabled, cloudwatchAgentServiceEndpoint, exporterPrefix, additionalEnvs[TypePython]),
139116
Resources: corev1.ResourceRequirements{
140117
Limits: getInstrumentationConfigForResource(python, limit),
141118
Requests: getInstrumentationConfigForResource(python, request),
142119
},
143120
},
144121
DotNet: v1alpha1.DotNet{
145122
Image: dotNetInstrumentationImage,
146-
Env: []corev1.EnvVar{
147-
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"},
148-
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", http, cloudwatchAgentServiceEndpoint)},
149-
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"},
150-
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"},
151-
{Name: "OTEL_EXPORTER_OTLP_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316", exporterPrefix, cloudwatchAgentServiceEndpoint)},
152-
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)},
153-
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)},
154-
{Name: "OTEL_METRICS_EXPORTER", Value: "none"},
155-
{Name: "OTEL_DOTNET_DISTRO", Value: "aws_distro"},
156-
{Name: "OTEL_DOTNET_CONFIGURATOR", Value: "aws_configurator"},
157-
{Name: "OTEL_LOGS_EXPORTER", Value: "none"},
158-
{Name: "OTEL_DOTNET_AUTO_PLUGINS", Value: "AWS.Distro.OpenTelemetry.AutoInstrumentation.Plugin, AWS.Distro.OpenTelemetry.AutoInstrumentation"},
159-
},
123+
Env: getDotNetEnvs(isApplicationSignalsEnabled, cloudwatchAgentServiceEndpoint, exporterPrefix, additionalEnvs[TypeDotNet]),
160124
Resources: corev1.ResourceRequirements{
161125
Limits: getInstrumentationConfigForResource(dotNet, limit),
162126
Requests: getInstrumentationConfigForResource(dotNet, request),
163127
},
164128
},
165129
NodeJS: v1alpha1.NodeJS{
166130
Image: nodeJSInstrumentationImage,
167-
Env: []corev1.EnvVar{
168-
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"},
169-
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", exporterPrefix, cloudwatchAgentServiceEndpoint)},
170-
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"},
171-
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"},
172-
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)},
173-
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)},
174-
{Name: "OTEL_METRICS_EXPORTER", Value: "none"},
175-
{Name: "OTEL_LOGS_EXPORTER", Value: "none"},
176-
},
131+
Env: getNodeJSEnvs(isApplicationSignalsEnabled, cloudwatchAgentServiceEndpoint, exporterPrefix, additionalEnvs[TypeDotNet]),
177132
Resources: corev1.ResourceRequirements{
178133
Limits: getInstrumentationConfigForResource(nodeJS, limit),
179134
Requests: getInstrumentationConfigForResource(nodeJS, request),
@@ -182,3 +137,99 @@ func getDefaultInstrumentation(agentConfig *adapters.CwaConfig, isWindowsPod boo
182137
},
183138
}, nil
184139
}
140+
141+
func getJavaEnvs(isAppSignalsEnabled bool, cloudwatchAgentServiceEndpoint, exporterPrefix string, additionalEnvs map[string]string) []corev1.EnvVar {
142+
envs := []corev1.EnvVar{
143+
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"},
144+
{Name: "OTEL_METRICS_EXPORTER", Value: "none"},
145+
{Name: "OTEL_LOGS_EXPORTER", Value: "none"},
146+
}
147+
148+
if isAppSignalsEnabled {
149+
appSignalsEnvs := []corev1.EnvVar{
150+
{Name: "OTEL_AWS_APP_SIGNALS_ENABLED", Value: "true"}, //TODO: remove in favor of new name once safe
151+
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"},
152+
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", http, cloudwatchAgentServiceEndpoint)},
153+
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"},
154+
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)},
155+
{Name: "OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)}, //TODO: remove in favor of new name once safe
156+
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)},
157+
}
158+
envs = append(envs, appSignalsEnvs...)
159+
} else {
160+
envs = append(envs, corev1.EnvVar{
161+
Name: "OTEL_TRACES_EXPORTER", Value: "none",
162+
})
163+
}
164+
165+
var jmxEnvs []corev1.EnvVar
166+
if targetSystems, ok := additionalEnvs[jmx.EnvTargetSystem]; ok {
167+
jmxEnvs = []corev1.EnvVar{
168+
{Name: "OTEL_AWS_JMX_EXPORTER_METRICS_ENDPOINT", Value: fmt.Sprintf("%s://%s:4314/v1/metrics", http, cloudwatchAgentServiceEndpoint)},
169+
{Name: "OTEL_JMX_TARGET_SYSTEM", Value: targetSystems},
170+
}
171+
}
172+
if len(jmxEnvs) != 0 {
173+
envs = append(envs, jmxEnvs...)
174+
}
175+
return envs
176+
}
177+
178+
func getPythonEnvs(isAppSignalsEnabled bool, cloudwatchAgentServiceEndpoint, exporterPrefix string, additionalEnvs map[string]string) []corev1.EnvVar {
179+
var envs []corev1.EnvVar
180+
if isAppSignalsEnabled {
181+
envs = []corev1.EnvVar{
182+
{Name: "OTEL_AWS_APP_SIGNALS_ENABLED", Value: "true"}, //TODO: remove in favor of new name once safe
183+
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"},
184+
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", http, cloudwatchAgentServiceEndpoint)},
185+
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"},
186+
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"},
187+
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)},
188+
{Name: "OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)}, //TODO: remove in favor of new name once safe
189+
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)},
190+
{Name: "OTEL_METRICS_EXPORTER", Value: "none"},
191+
{Name: "OTEL_PYTHON_DISTRO", Value: "aws_distro"},
192+
{Name: "OTEL_PYTHON_CONFIGURATOR", Value: "aws_configurator"},
193+
{Name: "OTEL_LOGS_EXPORTER", Value: "none"},
194+
}
195+
}
196+
return envs
197+
}
198+
199+
func getDotNetEnvs(isAppSignalsEnabled bool, cloudwatchAgentServiceEndpoint, exporterPrefix string, additionalEnvs map[string]string) []corev1.EnvVar {
200+
var envs []corev1.EnvVar
201+
if isAppSignalsEnabled {
202+
envs = []corev1.EnvVar{
203+
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"},
204+
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", http, cloudwatchAgentServiceEndpoint)},
205+
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"},
206+
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"},
207+
{Name: "OTEL_EXPORTER_OTLP_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316", exporterPrefix, cloudwatchAgentServiceEndpoint)},
208+
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)},
209+
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)},
210+
{Name: "OTEL_METRICS_EXPORTER", Value: "none"},
211+
{Name: "OTEL_DOTNET_DISTRO", Value: "aws_distro"},
212+
{Name: "OTEL_DOTNET_CONFIGURATOR", Value: "aws_configurator"},
213+
{Name: "OTEL_LOGS_EXPORTER", Value: "none"},
214+
{Name: "OTEL_DOTNET_AUTO_PLUGINS", Value: "AWS.Distro.OpenTelemetry.AutoInstrumentation.Plugin, AWS.Distro.OpenTelemetry.AutoInstrumentation"},
215+
}
216+
}
217+
return envs
218+
}
219+
220+
func getNodeJSEnvs(isAppSignalsEnabled bool, cloudwatchAgentServiceEndpoint, exporterPrefix string, additionalEnvs map[string]string) []corev1.EnvVar {
221+
var envs []corev1.EnvVar
222+
if isAppSignalsEnabled {
223+
envs = []corev1.EnvVar{
224+
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"},
225+
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", exporterPrefix, cloudwatchAgentServiceEndpoint)},
226+
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"},
227+
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"},
228+
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)},
229+
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)},
230+
{Name: "OTEL_METRICS_EXPORTER", Value: "none"},
231+
{Name: "OTEL_LOGS_EXPORTER", Value: "none"},
232+
}
233+
}
234+
return envs
235+
}

0 commit comments

Comments
 (0)