Skip to content

Add user details when DefaultPII is enabled#1018

Merged
giortzisg merged 5 commits intomasterfrom
user-info-pii
Jun 5, 2025
Merged

Add user details when DefaultPII is enabled#1018
giortzisg merged 5 commits intomasterfrom
user-info-pii

Conversation

@giortzisg
Copy link
Copy Markdown
Contributor

Closes #1017 .

When SendDefaultPII is enabled, we should be adding user details on the logs payload.

@giortzisg giortzisg requested a review from cleptric May 28, 2025 14:07
@giortzisg giortzisg self-assigned this May 28, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.50%. Comparing base (5af1e59) to head (51c45b7).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1018      +/-   ##
==========================================
+ Coverage   85.45%   85.50%   +0.05%     
==========================================
  Files          55       55              
  Lines        5486     5500      +14     
==========================================
+ Hits         4688     4703      +15     
  Misses        653      653              
+ Partials      145      144       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

log.go Outdated
attrs["sentry.server.address"] = Attribute{Value: serverAddr, Type: "string"}
}
if l.client.options.SendDefaultPII {
user := GetHubFromContext(ctx).Scope().user
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetHubFromContext(ctx) might return nil

log.go Outdated
Comment on lines +126 to +128
attrs["user.id"] = Attribute{Value: user.ID, Type: "string"}
attrs["user.name"] = Attribute{Value: user.Name, Type: "string"}
attrs["user.email"] = Attribute{Value: user.Email, Type: "string"}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should likely check for ""

@giortzisg giortzisg requested a review from cleptric June 3, 2025 13:49
ServerName: "test-server",
EnableLogs: true,
EnableTracing: true,
SendDefaultPII: true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also have a test that does the reverse.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@giortzisg giortzisg requested a review from cleptric June 5, 2025 09:28
@giortzisg giortzisg merged commit abc8abb into master Jun 5, 2025
17 checks passed
@giortzisg giortzisg deleted the user-info-pii branch June 5, 2025 12:03
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.

Add user attributes to Go logs

2 participants