Skip to content

feat(csharp): add PII redaction in tracing, by default#4027

Open
birschick-bq wants to merge 16 commits intoapache:mainfrom
birschick-bq:dev/birschick-bq/pii-tracing
Open

feat(csharp): add PII redaction in tracing, by default#4027
birschick-bq wants to merge 16 commits intoapache:mainfrom
birschick-bq:dev/birschick-bq/pii-tracing

Conversation

@birschick-bq
Copy link
Copy Markdown
Contributor

@birschick-bq birschick-bq commented Feb 27, 2026

Adds PII redaction in tracing, by default.

The new class ActivityWithPii wraps the System.Diagnostics.Activity object and replicates its interface. By default, the methods assume that tag values passed to the methods contain PII, unless explicitly marked otherwise (i.e., isPii = false).

The previous TraceActivity overloads and extension method that are use Activity have been marked as Obsolete. They have been replaced with overloads using the new ActivityWithPii class.

As marking the TraceActivity overloads and extension methods as Obsolete causes the build to fail, I've update the drivers in two commits. The first commit uses #pragma to ignore the warnings. The second commit, implements the change to use the new ActivityWithPii class.

The FileExporter and FileListener have been updated to reveal the original that have been redacted - with the assumption that writing to the local file system is controlled by an authorized user.

@birschick-bq
Copy link
Copy Markdown
Contributor Author

@CurtHagenlocher - let me know if you have some time to review this or if is a low priority for you. Thanks.

@davidhcoe
Copy link
Copy Markdown
Contributor

I think we can remove the changes that are under the Drivers folder since those are on the deprecation path. The changes are only needed in the new Foundry repo.

@davidhcoe
Copy link
Copy Markdown
Contributor

I think we can remove the changes that are under the Drivers folder since those are on the deprecation path. The changes are only needed in the new Foundry repo.

I see. You mention in the description the build was breaking without that.

@birschick-bq
Copy link
Copy Markdown
Contributor Author

I think we can remove the changes that are under the Drivers folder since those are on the deprecation path. The changes are only needed in the new Foundry repo.

I see. You mention in the description the build was breaking without that.

I could remove the Obsolete attributes, now that I've found all references. Then add back the Obsolete attribute once the other files are deprecated driver files and removed.

@davidhcoe
Copy link
Copy Markdown
Contributor

Yes lets do that.

@birschick-bq
Copy link
Copy Markdown
Contributor Author

birschick-bq commented Mar 29, 2026

Yes lets do that.

@davidhcoe - compromise, I had bracketed the obsolete method calls with #pragma warning disable CS0618 / #pragma warning restore CS0618. This is my original suggestion. Let me know if this reduces the impact on about-to-be deprecated/removed driver code. Thanks.

@davidhcoe
Copy link
Copy Markdown
Contributor

I would prefer to not have any changes in the Drivers folder. This will update the dates of all of the files and gives the illusion they are still under active development.

@birschick-bq birschick-bq marked this pull request as draft March 30, 2026 16:47
@birschick-bq birschick-bq marked this pull request as ready for review March 30, 2026 18:03
@birschick-bq
Copy link
Copy Markdown
Contributor Author

@davidhcoe

  • Removed any change from the drivers.
  • Refactored new overloads to be non-ambiguous.

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.

2 participants