Skip to content
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

Fix .NET instrumentation for .NET 6.0 #2056

Merged
merged 9 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
46 changes: 44 additions & 2 deletions tests/e2e/workload-lifecycle/01-assert-apps-installed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,53 @@ apiVersion: v1
kind: Pod
metadata:
labels:
app: dotnet-musl
app: dotnet8-musl
namespace: default
status:
containerStatuses:
- name: dotnet-musl
- name: dotnet8-musl
ready: true
restartCount: 0
started: true
phase: Running
---
apiVersion: v1
kind: Pod
metadata:
labels:
app: dotnet6-musl
namespace: default
status:
containerStatuses:
- name: dotnet6-musl
ready: true
restartCount: 0
started: true
phase: Running
---
apiVersion: v1
kind: Pod
metadata:
labels:
app: dotnet6-glibc
namespace: default
status:
containerStatuses:
- name: dotnet6-glibc
ready: true
restartCount: 0
started: true
phase: Running
---
apiVersion: v1
kind: Pod
metadata:
labels:
app: dotnet8-glibc
namespace: default
status:
containerStatuses:
- name: dotnet8-glibc
ready: true
restartCount: 0
started: true
Expand Down
59 changes: 55 additions & 4 deletions tests/e2e/workload-lifecycle/01-assert-runtime-detected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,67 @@ spec:
apiVersion: odigos.io/v1alpha1
kind: InstrumentedApplication
metadata:
name: deployment-dotnet-musl
name: deployment-dotnet8-musl
namespace: default
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: Deployment
name: dotnet-musl
name: dotnet8-musl
spec:
runtimeDetails:
- containerName: dotnet-musl
- containerName: dotnet8-musl
language: dotnet
libCType: musl
libCType: musl
---
apiVersion: odigos.io/v1alpha1
kind: InstrumentedApplication
metadata:
name: deployment-dotnet6-musl
namespace: default
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: Deployment
name: dotnet6-musl
spec:
runtimeDetails:
- containerName: dotnet6-musl
language: dotnet
libCType: musl
---
apiVersion: odigos.io/v1alpha1
kind: InstrumentedApplication
metadata:
name: deployment-dotnet8-glibc
namespace: default
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: Deployment
name: dotnet8-glibc
spec:
runtimeDetails:
- containerName: dotnet8-glibc
language: dotnet
libCType: glibc
---
apiVersion: odigos.io/v1alpha1
kind: InstrumentedApplication
metadata:
name: deployment-dotnet6-glibc
namespace: default
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: Deployment
name: dotnet6-glibc
spec:
runtimeDetails:
- containerName: dotnet6-glibc
language: dotnet
libCType: glibc
97 changes: 92 additions & 5 deletions tests/e2e/workload-lifecycle/01-assert-workloads.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -555,21 +555,108 @@ metadata:
deployment.kubernetes.io/revision: "2" # the deployment spec changed when odigos resource was added
generation: 2 # the deployment spec changed when odigos resource was added
labels:
app: dotnet-musl
name: dotnet-musl
app: dotnet8-musl
name: dotnet8-musl
namespace: default
spec:
selector:
matchLabels:
app: dotnet-musl
app: dotnet8-musl
template:
spec:
containers:
- image: dotnet-musl:v0.0.1
name: dotnet-musl
- image: dotnet8-musl:v0.0.1
name: dotnet8-musl
resources:
limits:
instrumentation.odigos.io/musl-dotnet-native-community: "1"
status:
availableReplicas: 1
observedGeneration: 2 # the deployment spec changed when odigos resource was added
readyReplicas: 1
replicas: 1
updatedReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "2" # the deployment spec changed when odigos resource was added
generation: 2 # the deployment spec changed when odigos resource was added
labels:
app: dotnet6-musl
name: dotnet6-musl
namespace: default
spec:
selector:
matchLabels:
app: dotnet6-musl
template:
spec:
containers:
- image: dotnet6-musl:v0.0.1
name: dotnet6-musl
resources:
limits:
instrumentation.odigos.io/musl-dotnet-native-community: "1"
status:
availableReplicas: 1
observedGeneration: 2 # the deployment spec changed when odigos resource was added
readyReplicas: 1
replicas: 1
updatedReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "2" # the deployment spec changed when odigos resource was added
generation: 2 # the deployment spec changed when odigos resource was added
labels:
app: dotnet8-glibc
name: dotnet8-glibc
namespace: default
spec:
selector:
matchLabels:
app: dotnet8-glibc
template:
spec:
containers:
- image: dotnet8-glibc:v0.0.1
name: dotnet8-glibc
resources:
limits:
instrumentation.odigos.io/dotnet-native-community: "1"
status:
availableReplicas: 1
observedGeneration: 2 # the deployment spec changed when odigos resource was added
readyReplicas: 1
replicas: 1
updatedReplicas: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "2" # the deployment spec changed when odigos resource was added
generation: 2 # the deployment spec changed when odigos resource was added
labels:
app: dotnet6-glibc
name: dotnet6-glibc
namespace: default
spec:
selector:
matchLabels:
app: dotnet6-glibc
template:
spec:
containers:
- image: dotnet6-glibc:v0.0.1
name: dotnet6-glibc
resources:
limits:
instrumentation.odigos.io/dotnet-native-community: "1"
status:
availableReplicas: 1
observedGeneration: 2 # the deployment spec changed when odigos resource was added
Expand Down
5 changes: 4 additions & 1 deletion tests/e2e/workload-lifecycle/01-generate-traffic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ spec:
curl -s --fail http://python-min-version:3000/insert-random/
curl -s --fail http://python-not-supported:3000/insert-random/

curl -s --fail http://dotnet-musl:8080
curl -s --fail http://dotnet8-musl:8080
curl -s --fail http://dotnet6-musl:8080
curl -s --fail http://dotnet8-glibc:8080
curl -s --fail http://dotnet6-glibc:8080
Loading
Loading