Skip to content

Logs: follow the standard keys we are using everywhere - #13326

Merged
humitos merged 1 commit into
mainfrom
humitos/nr-log-standard-keys
Oct 2, 2026
Merged

humitos merged 1 commit into
mainfrom
humitos/nr-log-standard-keys

Conversation

@humitos

@humitos humitos commented Sep 21, 2026

Copy link
Copy Markdown
Member

I found that we had different logging keys for the same thing in different files. That makes debugging more difficult. I'm sticking with the same name everywhere, following the patterns we already have established.

I found that we had different logging keys for the same thing
in different files. That makes debugging more difficult.
I'm sticking with the same name everywhere, following the patterns
we already have established.
@humitos
humitos requested a review from a team as a code owner September 21, 2026 13:50
@humitos
humitos requested a review from stsewd September 21, 2026 13:50
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 docs-upload | 🛠️ Build #34675833 | 📁 Comparing 2c30fcc against latest (00addb0)

  🔍 Preview build  

9 files changed · + 3 added · ± 4 modified · - 2 deleted

+ Added

± Modified

- Deleted

structlog.contextvars.bind_contextvars(
email=email_address.email,
username=user.username,
user_username=user.username,

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.

I think it's fine to username, we aren't using user_email above.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, I was following the <model>_<field> pattern we are following in the rest of the log lines, but maybe for username and email doesn't make too much sense.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh, I did the search and replace and it seems we are using user_username in a bunch of places already. So, it will be better to standardize to it instead of just username.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We can make user_email as well if we want to, and keep this model_field consistency there as well.

@humitos
humitos requested a review from stsewd September 30, 2026 11:14
@humitos

humitos commented Sep 30, 2026

Copy link
Copy Markdown
Member Author

I'd like to move forward here since I've been hitting issues when parsing NR logs due to having different keyword for the same values.

@humitos
humitos requested a review from ericholscher October 1, 2026 14:34

@ericholscher ericholscher left a comment

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.

This seems fine, but we should probably document this somewhere to keep it standardized.

@humitos

humitos commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

This seems fine, but we should probably document this somewhere to keep it standardized.

We don't really have a good place for this particular content. We could create a new page on https://docs.readthedocs.com/dev/latest/guides/index.html maybe?

I added to the AGENTS.md at least for now, so the agents follow this pattern when adding new logging keys: readthedocs/common#334

@humitos
humitos merged commit a66c8a4 into main Oct 2, 2026
12 of 13 checks passed
@humitos
humitos deleted the humitos/nr-log-standard-keys branch October 2, 2026 12:02
humitos added a commit to readthedocs/common that referenced this pull request Oct 5, 2026
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.

3 participants