-
Notifications
You must be signed in to change notification settings - Fork 28
Support .NET auto instrumentation and Windows platforms #193
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
Merged
+331
−96
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2969467
Add support for dotnet instrumentation (#168)
mitali-salvi 59115cc
Merge with main
lisguo bc0157d
Test
lisguo 191e50f
Check if the pod is on windows and append -windows to the instrumenta…
lisguo 69c7e92
Refactor default instrumentation logic to use windows service
lisguo 251843f
Fix command for .net
lisguo d8309d7
Fix variable name conflict
lisguo 8ed7a75
Change env variables for .NET on windows
lisguo 694a1af
Add OTEL_DOTNET_AUTO_PLUGINS env variable
lisguo 0cf563a
Use headless service for windows
lisguo 91cc6a7
Remove windows specific tags. Use v0.0.0 of adot .net image
lisguo 9faca1f
Fix unit tests. Run linter
lisguo cdf5ae3
Add OTEL_EXPORTER_OTLP_ENDPOINT env variable for .NET
lisguo c934633
Add DotNet to annotation mutator
lisguo 92bc7fa
Add comment on windows headless service endpoint. Update README with …
lisguo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -5,6 +5,7 @@ package instrumentation | |
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"os" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
|
@@ -20,11 +21,11 @@ const ( | |
defaultNamespace = "default" | ||
defaultKind = "Instrumentation" | ||
|
||
httpPrefix = "http://" | ||
httpsPrefix = "https://" | ||
http = "http" | ||
https = "https" | ||
) | ||
|
||
func getDefaultInstrumentation(agentConfig *adapters.CwaConfig) (*v1alpha1.Instrumentation, error) { | ||
func getDefaultInstrumentation(agentConfig *adapters.CwaConfig, isWindowsPod bool) (*v1alpha1.Instrumentation, error) { | ||
javaInstrumentationImage, ok := os.LookupEnv("AUTO_INSTRUMENTATION_JAVA") | ||
if !ok { | ||
return nil, errors.New("unable to determine java instrumentation image") | ||
|
@@ -33,13 +34,22 @@ func getDefaultInstrumentation(agentConfig *adapters.CwaConfig) (*v1alpha1.Instr | |
if !ok { | ||
return nil, errors.New("unable to determine python instrumentation image") | ||
} | ||
dotNetInstrumentationImage, ok := os.LookupEnv("AUTO_INSTRUMENTATION_DOTNET") | ||
if !ok { | ||
return nil, errors.New("unable to determine dotnet instrumentation image") | ||
} | ||
|
||
cloudwatchAgentServiceEndpoint := "cloudwatch-agent.amazon-cloudwatch" | ||
if isWindowsPod { | ||
cloudwatchAgentServiceEndpoint = "cloudwatch-agent-windows-headless.amazon-cloudwatch.svc.cluster.local" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need to use headless endpoint for windows nodes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick - worth adding a comment on why does the service endpoint differ for windows |
||
} | ||
|
||
// set protocol by checking cloudwatch agent config for tls setting | ||
exporterPrefix := httpPrefix | ||
exporterPrefix := http | ||
if agentConfig != nil { | ||
appSignalsConfig := agentConfig.GetApplicationSignalsConfig() | ||
if appSignalsConfig != nil && appSignalsConfig.TLS != nil { | ||
exporterPrefix = httpsPrefix | ||
exporterPrefix = https | ||
} | ||
} | ||
|
||
|
@@ -65,12 +75,12 @@ func getDefaultInstrumentation(agentConfig *adapters.CwaConfig) (*v1alpha1.Instr | |
Env: []corev1.EnvVar{ | ||
{Name: "OTEL_AWS_APP_SIGNALS_ENABLED", Value: "true"}, //TODO: remove in favor of new name once safe | ||
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"}, | ||
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: "endpoint=http://cloudwatch-agent.amazon-cloudwatch:2000"}, | ||
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", http, cloudwatchAgentServiceEndpoint)}, | ||
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"}, | ||
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"}, | ||
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: exporterPrefix + "cloudwatch-agent.amazon-cloudwatch:4316/v1/traces"}, | ||
{Name: "OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT", Value: exporterPrefix + "cloudwatch-agent.amazon-cloudwatch:4316/v1/metrics"}, //TODO: remove in favor of new name once safe | ||
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: exporterPrefix + "cloudwatch-agent.amazon-cloudwatch:4316/v1/metrics"}, | ||
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)}, | ||
{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 | ||
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)}, | ||
{Name: "OTEL_METRICS_EXPORTER", Value: "none"}, | ||
{Name: "OTEL_LOGS_EXPORTER", Value: "none"}, | ||
}, | ||
|
@@ -80,18 +90,35 @@ func getDefaultInstrumentation(agentConfig *adapters.CwaConfig) (*v1alpha1.Instr | |
Env: []corev1.EnvVar{ | ||
{Name: "OTEL_AWS_APP_SIGNALS_ENABLED", Value: "true"}, //TODO: remove in favor of new name once safe | ||
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"}, | ||
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: "endpoint=http://cloudwatch-agent.amazon-cloudwatch:2000"}, | ||
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", http, cloudwatchAgentServiceEndpoint)}, | ||
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"}, | ||
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"}, | ||
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: exporterPrefix + "cloudwatch-agent.amazon-cloudwatch:4316/v1/traces"}, | ||
{Name: "OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT", Value: exporterPrefix + "cloudwatch-agent.amazon-cloudwatch:4316/v1/metrics"}, //TODO: remove in favor of new name once safe | ||
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: exporterPrefix + "cloudwatch-agent.amazon-cloudwatch:4316/v1/metrics"}, | ||
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)}, | ||
{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 | ||
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)}, | ||
{Name: "OTEL_METRICS_EXPORTER", Value: "none"}, | ||
{Name: "OTEL_PYTHON_DISTRO", Value: "aws_distro"}, | ||
{Name: "OTEL_PYTHON_CONFIGURATOR", Value: "aws_configurator"}, | ||
{Name: "OTEL_LOGS_EXPORTER", Value: "none"}, | ||
}, | ||
}, | ||
DotNet: v1alpha1.DotNet{ | ||
Image: dotNetInstrumentationImage, | ||
Env: []corev1.EnvVar{ | ||
{Name: "OTEL_AWS_APPLICATION_SIGNALS_ENABLED", Value: "true"}, | ||
{Name: "OTEL_TRACES_SAMPLER_ARG", Value: fmt.Sprintf("endpoint=%s://%s:2000", http, cloudwatchAgentServiceEndpoint)}, | ||
{Name: "OTEL_TRACES_SAMPLER", Value: "xray"}, | ||
{Name: "OTEL_EXPORTER_OTLP_PROTOCOL", Value: "http/protobuf"}, | ||
{Name: "OTEL_EXPORTER_OTLP_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316", exporterPrefix, cloudwatchAgentServiceEndpoint)}, | ||
{Name: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/traces", exporterPrefix, cloudwatchAgentServiceEndpoint)}, | ||
{Name: "OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT", Value: fmt.Sprintf("%s://%s:4316/v1/metrics", exporterPrefix, cloudwatchAgentServiceEndpoint)}, | ||
{Name: "OTEL_METRICS_EXPORTER", Value: "none"}, | ||
{Name: "OTEL_DOTNET_DISTRO", Value: "aws_distro"}, | ||
{Name: "OTEL_DOTNET_CONFIGURATOR", Value: "aws_configurator"}, | ||
{Name: "OTEL_LOGS_EXPORTER", Value: "none"}, | ||
{Name: "OTEL_DOTNET_AUTO_PLUGINS", Value: "AWS.Distro.OpenTelemetry.AutoInstrumentation.Plugin, AWS.Distro.OpenTelemetry.AutoInstrumentation"}, | ||
}, | ||
}, | ||
}, | ||
}, nil | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.