sentry-javascript
sentry-javascript copied to clipboard
Add getTags to Scope
Problem Statement
This code example pretty much sums up the problem:
function getTags(hub: Hub): Record<string, number | string | undefined> {
// @ts-expect-error No other way of accessing protected property _tags
return hub.getScope()?._tags || {};
}
In our large SPA tags are added and removed pretty often and we'd like to use them in integrations.
Solution Brainstorm
type Tags = { [key: string]: Primitive };
export interface Hub {
getTags(): Tags;
}
Thanks for reaching out! Backlogging for now, since I think we need to make sure we are comfortable with the extra API surface this will introduce.