Skip to content

Commit

Permalink
Fix .NET auto instrumentation for .NET 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
edeNFed committed Dec 24, 2024
1 parent 5f47da1 commit f0205c7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
11 changes: 11 additions & 0 deletions docs/instrumentations/dotnet/dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,14 @@ The following .NET modules will be auto instrumented by Odigos:
| [Kafka](https://www.nuget.org/packages/Confluent.Kafka) | | | |
| [NServiceBus](https://docs.particular.net/nservicebus/) | Yes | Yes | |
| [MassTransit](https://masstransit-project.com/) | Yes | | |

## Automatic Testing

The following scenarios are automatically tested with every release:

| .NET Version | LibC type | CPU |
|--------------|-----------|-------|
| 6.0 | glibc | amd64 |
| 6.0 | musl | amd64 |
| 8.0 | glibc | amd64 |
| 8.0 | musl | amd64 |
7 changes: 7 additions & 0 deletions odiglet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ RUN ARCH_SUFFIX=$(cat /tmp/arch_suffix) && \
unzip opentelemetry-dotnet-instrumentation-linux-musl-${ARCH_SUFFIX}.zip "linux-musl-$ARCH_SUFFIX/*" -d . && \
rm opentelemetry-dotnet-instrumentation-linux-musl-${ARCH_SUFFIX}.zip

# TODO(edenfed): Currently .NET Automatic instrumentation does not work on dotnet 6.0 with glibc,
# This is due to compilation of the .so file on a newer version of glibc than the one used by the dotnet runtime.
# The following override the .so file with our own which is compiled on the same glibc version as the dotnet runtime.
RUN ARCH_SUFFIX=$(cat /tmp/arch_suffix) && \
wget https://github.com/odigos-io/opentelemetry-dotnet-instrumentation/releases/download/${DOTNET_OTEL_VERSION}/OpenTelemetry.AutoInstrumentation.Native-${ARCH_SUFFIX}.so && \
mv OpenTelemetry.AutoInstrumentation.Native-${ARCH_SUFFIX}.so linux-glibc-${ARCH_SUFFIX}/OpenTelemetry.AutoInstrumentation.Native.so

FROM --platform=$BUILDPLATFORM keyval/odiglet-base:v1.7 AS builder
WORKDIR /go/src/github.com/odigos-io/odigos
# Copy local modules required by the build
Expand Down
13 changes: 12 additions & 1 deletion odiglet/debug.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,18 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
RUN ARCH_SUFFIX=$(cat /tmp/arch_suffix) && \
wget https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/download/${DOTNET_OTEL_VERSION}/opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip && \
unzip opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip && \
rm opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip
rm opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip && \
mv linux-$ARCH_SUFFIX linux-glibc-$ARCH_SUFFIX && \
wget https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/download/${DOTNET_OTEL_VERSION}/opentelemetry-dotnet-instrumentation-linux-musl-${ARCH_SUFFIX}.zip && \
unzip opentelemetry-dotnet-instrumentation-linux-musl-${ARCH_SUFFIX}.zip "linux-musl-$ARCH_SUFFIX/*" -d . && \
rm opentelemetry-dotnet-instrumentation-linux-musl-${ARCH_SUFFIX}.zip

# TODO(edenfed): Currently .NET Automatic instrumentation does not work on dotnet 6.0 with glibc,
# This is due to compilation of the .so file on a newer version of glibc than the one used by the dotnet runtime.
# The following override the .so file with our own which is compiled on the same glibc version as the dotnet runtime.
RUN ARCH_SUFFIX=$(cat /tmp/arch_suffix) && \
wget https://github.com/odigos-io/opentelemetry-dotnet-instrumentation/releases/download/${DOTNET_OTEL_VERSION}/OpenTelemetry.AutoInstrumentation.Native-${ARCH_SUFFIX}.so && \
mv OpenTelemetry.AutoInstrumentation.Native-${ARCH_SUFFIX}.so linux-glibc-${ARCH_SUFFIX}/OpenTelemetry.AutoInstrumentation.Native.so

FROM --platform=$BUILDPLATFORM keyval/odiglet-base:v1.7 AS builder
WORKDIR /go/src/github.com/odigos-io/odigos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ spec:
apiVersion: odigos.io/v1alpha1
kind: InstrumentedApplication
metadata:
name: deployment-dotnet8-musl
name: deployment-dotnet6-musl
namespace: default
ownerReferences:
- apiVersion: apps/v1
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/workload-lifecycle/01-assert-workloads.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ metadata:
spec:
selector:
matchLabels:
app: dotnet8-musl
app: dotnet6-musl
template:
spec:
containers:
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/workload-lifecycle/03-wait-for-trace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ description: This test waits for a trace that is generated from the successful i
query: |
{ resource.k8s.cluster.name = "e2e-test-cluster" }
expected:
count: 14
count: 17

0 comments on commit f0205c7

Please sign in to comment.