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

[bug] Instrumentation query redaction does not respect environment variable #6118

Closed
CEbbinghaus opened this issue Jan 31, 2025 · 5 comments
Closed
Labels
bug Something isn't working needs-triage New issues which have not been classified or triaged by a community member pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package

Comments

@CEbbinghaus
Copy link

Package

OpenTelemetry

Package Version

Package Name Version
OpenTelemetry 1.10.0
OpenTelemetry.Exporter.Console 1.10.0
OpenTelemetry.Instrumentation.Http 1.10.0

Runtime Version

net8.0

Description

When setting the environment variable from within C# it does not disable the redaction of query parameters, leading to entirely useless telemetry for any service that uses query parameters for anything other than user tracking...

Steps to Reproduce

  • Use Otel as recommended
  • Use version 1.8.1 or above
  • Set OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_DISABLE_URL_QUERY_REDACTION from within application.
  • Profit??? (It still redacts every single query parameter...)

Expected Result

It not to redact important or any query parameter for that matter.

Actual Result

It still redacts every single query parameter...

Additional Context

Minimal repro: https://github.com/CEbbinghaus/OpenTelemetryEnvRepro
Related issues:

@CEbbinghaus CEbbinghaus added bug Something isn't working needs-triage New issues which have not been classified or triaged by a community member labels Jan 31, 2025
@github-actions github-actions bot added the pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package label Jan 31, 2025
@Kielek
Copy link
Contributor

Kielek commented Jan 31, 2025

@CEbbinghaus, I didn't executed the code, but you are using https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.Http.

It requires to set OTEL_DOTNET_EXPERIMENTAL_HTTPCLIENT_DISABLE_URL_QUERY_REDACTION instead of OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_DISABLE_URL_QUERY_REDACTION

@CEbbinghaus
Copy link
Author

Ah. Good catch but I think that is more an artifact of my refactoring than the problem. I very confident that by just replacing the environment variable it will still redact even if it is set correctly

@rajkumar-rangaraj
Copy link
Contributor

I noticed that your current repro project is based on an ASP.NET Core application, as indicated by the following line in your .csproj file: <Project Sdk="Microsoft.NET.Sdk.Web">

For a console app, this should instead be: <Project Sdk="Microsoft.NET.Sdk">

To help isolate the issue and ensure accurate testing, I recommend creating a new console-based application. I created a new console app by copying the content from your repro, and it works as expected.

@CEbbinghaus
Copy link
Author

It seems @Kielek had the correct answer, when configuring Otel via the HttpClient library rather than ASP.Net Core it requires the OTEL_DOTNET_EXPERIMENTAL_HTTPCLIENT_DISABLE_URL_QUERY_REDACTION query parameter to be set rather than the ASPNETCORE version...

It would be really nice if this was documented anywhere rather than requiring comments on random github issues to resolve

@cijothomas
Copy link
Member

It would be really nice if this was documented anywhere rather than requiring comments on random github issues to resolve

It is part of the doc.
https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/main/src/OpenTelemetry.Instrumentation.Http/README.md?plain=1#L89

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage New issues which have not been classified or triaged by a community member pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package
Projects
None yet
Development

No branches or pull requests

4 participants