Skip to content

Commit

Permalink
Set Sentry tags (#637)
Browse files Browse the repository at this point in the history
Together with getodk/central#317, closes #547.
  • Loading branch information
matthew-white authored Oct 11, 2022
1 parent 1d6404a commit 0c19dfc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/external/sentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to the terms contained in the LICENSE file.

const { inspect } = require('util');
const { isBlank } = require('../util/util');
const { isBlank, isPresent } = require('../util/util');


// Endpoints where query strings are sensitive and should be removed
Expand Down Expand Up @@ -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);
for (const [key, value] of Object.entries(tags))
Sentry.setTag(key, value);
}

return Sentry;
};

Expand Down

0 comments on commit 0c19dfc

Please sign in to comment.