Skip to content

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
merged 15 commits into from
Jul 16, 2024
Merged

Conversation

lisguo
Copy link
Contributor

@lisguo lisguo commented Jul 11, 2024

Issue #, if available: N/A

Description of changes:

  • Add support for .NET auto instrumentation with the current placeholder image public.ecr.aws/aws-observability/adot-autoinstrumentation-dotnet:v0.0.0.
  • Check if the pod is a windows pod by looking at the node affinity, and if it is windows:
    • modify the command to be windows compatible
    • use the headless service, as the cluster IP is not supported on windows nodes

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@lisguo lisguo requested review from movence and Paramadon July 11, 2024 19:04

cloudwatchAgentServiceEndpoint := "cloudwatch-agent.amazon-cloudwatch"
if isWindowsPod {
cloudwatchAgentServiceEndpoint = "cloudwatch-agent-windows-headless.amazon-cloudwatch.svc.cluster.local"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to use headless endpoint for windows nodes

Copy link
Contributor

Choose a reason for hiding this comment

The 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

args: args{
agentConfig: &adapters.CwaConfig{
Logs: &adapters.Logs{
LogMetricsCollected: &adapters.LogMetricsCollected{
AppSignals: &adapters.AppSignals{},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppSignals is not used anymore, it's safe to remove. I can have a follow-up PR to remove


defaultInst := &v1alpha1.Instrumentation{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to test the Instrumentation object here, since it's covered in the getDefaultInstrumentation unit tests

@@ -68,6 +69,23 @@ func Test_getDefaultInstrumentation(t *testing.T) {
{Name: "OTEL_LOGS_EXPORTER", Value: "none"},
},
},
DotNet: v1alpha1.DotNet{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vastin can you confirm these env variables?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is correct.

dotnetVolumeName = volumeName + "-dotnet"
dotnetInitContainerName = initContainerName + "-dotnet"
dotnetInstrMountPath = "/otel-auto-instrumentation-dotnet"
)

const (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vastin can you confirm these windows mount points too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It is confirmed.

@lisguo lisguo requested review from sky333999 and removed request for movence July 12, 2024 17:32
Copy link
Contributor

@Paramadon Paramadon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just want to verify the auto annotation question and if the env vars are correct.

Copy link
Contributor

@vastin vastin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -68,6 +69,23 @@ func Test_getDefaultInstrumentation(t *testing.T) {
{Name: "OTEL_LOGS_EXPORTER", Value: "none"},
},
},
DotNet: v1alpha1.DotNet{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is correct.

dotnetVolumeName = volumeName + "-dotnet"
dotnetInitContainerName = initContainerName + "-dotnet"
dotnetInstrMountPath = "/otel-auto-instrumentation-dotnet"
)

const (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It is confirmed.

dotNetStartupHookPathWindows = "C:\\otel-auto-instrumentation-dotnet\\net\\OpenTelemetry.AutoInstrumentation.StartupHook.dll"
dotnetInstrMountPathWindows = "\\otel-auto-instrumentation-dotnet"
)

// Supported .NET runtime identifiers (https://learn.microsoft.com/en-us/dotnet/core/rid-catalog), can be set by instrumentation.opentelemetry.io/inject-dotnet.
const (
dotNetRuntimeLinuxGlibc = "linux-x64"
dotNetRuntimeLinuxMusl = "linux-musl-x64"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will CORECLR_PROFILER_PATH be set for "linux-musl-x64" like OTel Operator?

    - name: CORECLR_PROFILER_PATH
      value: /otel-auto-instrumentation-dotnet/linux-musl-x64/OpenTelemetry.AutoInstrumentation.Native.so

@lisguo lisguo requested review from mitali-salvi and removed request for sky333999 July 16, 2024 14:42
Paramadon
Paramadon previously approved these changes Jul 16, 2024
Copy link
Contributor

@Paramadon Paramadon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Contributor

@mitali-salvi mitali-salvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be out of scope of this PR but we should be updated the README when providing support for new languages


cloudwatchAgentServiceEndpoint := "cloudwatch-agent.amazon-cloudwatch"
if isWindowsPod {
cloudwatchAgentServiceEndpoint = "cloudwatch-agent-windows-headless.amazon-cloudwatch.svc.cluster.local"
Copy link
Contributor

Choose a reason for hiding this comment

The 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

@lisguo lisguo merged commit 5a9b93a into aws:main Jul 16, 2024
6 checks passed
Paramadon added a commit that referenced this pull request Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants