open-telemetry / opentelemetry-dotnet-instrumentation

OpenTelemetry .NET Automatic Instrumentation
https://opentelemetry.io
Apache License 2.0
368 stars 91 forks source link

run example/demo error on Mac,no tracing generated #3586

Open caterchong opened 2 months ago

caterchong commented 2 months ago

Bug Report

Symptom

Mac's chip: Apple M2 pro docker: docker desktop(v4.33.0). settings->General-> User Rosetta for x86_64/amd64 emulation on Apple Silicon opened.

make

There is no tracing. in demo/log dir, all log files are empty.

check demo-service, /var/log/opentelemetry/dotnet/otel-dotnet-auto-1-Examples.Service-StartupHook-20240822.log

[Error] CLR profiler (64bit) is not found at '/otel-dotnet-auto/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so'. Recheck 'CORECLR_PROFILER_PATH'.

should auto instrument and output tracing normally

bug reason

in demo/otel-dotnet.env

CORECLR_PROFILER_PATH="/otel-dotnet-auto/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so"

It's hard-coded to linux-x64

RassK commented 2 months ago

I guess the emulator outputs environment as Linux. In case of using emulators you may need to tweak the envs manually using https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/config.md

caterchong commented 2 months ago

the emulator outputs the right environment variable , linux with arm64 arch.

docker build works fine, intalls the right so,

/otel-dotnet-auto/linux-arm64/OpenTelemetry.AutoInstrumentation.Native.so

docker-compose.yaml

    env_file:
      - otel-dotnet.env # enables OpenTelemetry .NET Automatic Instrumentation

otel-dotnet.env hardcode _CORECLR_PROFILERPATH with linux-x64 ,which is wrong under mac m2 pro.

/otel-dotnet-auto/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
RassK commented 2 months ago

the emulator outputs the right environment variable , linux with arm64 arch.

@caterchong Shouldn't it be linux-x64 after the emulation? If emulator outputs arm64 instead of x64, it's definitely wrong. It should be x64 for the application, so emulator translates x64 to arm64.

pjanotti commented 1 month ago

I couldn't get hold of a arm mac to try to repro this. Until some dev on the SIG can get a hold of one it is going to be hard to make progress without detailed repro steps.