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

Set Sentry tags #637

Merged
merged 1 commit into from
Oct 11, 2022
Merged

Set Sentry tags #637

merged 1 commit into from
Oct 11, 2022

Conversation

matthew-white
Copy link
Member

@matthew-white matthew-white commented Oct 10, 2022

This PR sets Sentry tags that are specified in an environment variable named SENTRY_TAGS. The approach is generic — any sort of tags could be set — but it was developed as part of getodk/central#317 in order to pass Central version information to Sentry. Together with getodk/central#317, this PR closes #547.

What has been done to verify that this works as intended?

Nothing yet. Once this PR has been merged, I'll verify it on the QA server.

Why is this the best possible solution? Were any other approaches considered?

We discussed this broad strategy in getodk/central#317.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

This change only touches Sentry. When I verify this change, that'll also verify that Sentry is still working.

Does this change require updates to the API documentation? If so, please update docs/api.md as part of this PR.

No change needed.

Before submitting this PR, please make sure you have:

  • run make test-full and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments

@@ -133,6 +133,11 @@ const init = (config) => {
const username = require('os').hostname();
Sentry.setUser({ username });

if (isPresent(process.env.SENTRY_TAGS)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

SENTRY_TAGS won't typically be present during local development.

Together with getodk/central#317, closes #547.
@@ -133,6 +133,12 @@ const init = (config) => {
const username = require('os').hostname();
Sentry.setUser({ username });

if (isPresent(process.env.SENTRY_TAGS)) {
const tags = JSON.parse(process.env.SENTRY_TAGS);
Copy link
Member Author

Choose a reason for hiding this comment

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

At getodk/central#317 (comment), I was thinking of wrapping the JSON.parse() in a try/catch. However, I've ended up thinking that that'd be premature. We don't expose SENTRY_TAGS to users. And if there's a problem with SENTRY_TAGS, that would indicate a bug that we'd want to know about.

@matthew-white
Copy link
Member Author

matthew-white commented Oct 11, 2022

I deployed this PR to the QA server. Version information isn't coming through, but I'm pretty sure it's an issue with getodk/central#317, not this PR. I'll merge this PR, then file an issue on central.

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 version information to Sentry to identify versions
2 participants