Skip to content

ref(pii): Better explanation of selectors #1562

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

Merged
merged 7 commits into from
Mar 20, 2020

Conversation

untitaker
Copy link
Member

Also remove some useless value types that I might want to remove: booleans are never stripped, ever, and the event value type does not work at the moment.

Also remove some useless value types that I might want to remove
@untitaker untitaker requested a review from mitsuhiko March 19, 2020 12:22
untitaker added a commit to getsentry/relay that referenced this pull request Mar 20, 2020
Context: [Selectors for Advanced Data Scrubbing](https://docs.sentry.io/data-management/advanced-datascrubbing/#selectors)

See also diff of this section in getsentry/sentry-docs#1562 for what spawned this idea...

This is more in line with what discover offers as column names:

* `$http.url` instead of `$request.url`, as `http.url` can be queried in discover
* `$error.value` instead of `$exception.value`, as `error.value` can be queried in discover
* `$message` as alias to `$logentry.formatted`

I liked some of the old values better but consistency trumps.

Eventually we might want to consider removing some value types too (`logentry` seems pretty useless to me), but I am fairly confident we can do that at later points in time.
Copy link
Contributor

@rhcarvalho rhcarvalho left a comment

Choose a reason for hiding this comment

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

Great stuff, thanks for revising the docs. 👍

You can select a region of the event using JSON-path-like syntax. As an example, to delete a specific key in "Additional Data", you would configure:
Selectors allow you to restrict rules to certain parts of the event. This is useful to unconditionally remove certain data by variable/field name from the event, but can also be used to conservatively test rules on real data.

Data scrubbing always works on the raw event payload. Keep in mind that some fields in the UI may be called differently in the JSON schema. When looking at an event there should always be a link called "JSON" present that allows you to see what the data scrubber sees.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is great. Thanks for pointing it out clearly. The example below is also very good.

For example, what is called "Additional Data" in the UI is called `extra` in the event payload. To remove a specific key called `foo`, you would write:

```
[Remove] [Anything] from [extra.foo]
Copy link
Contributor

Choose a reason for hiding this comment

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

My curiosity, does this apply equally to error/exception events, message events and transaction/spans events?

Copy link
Member Author

Choose a reason for hiding this comment

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

to all of them

Copy link
Contributor

Choose a reason for hiding this comment

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

Removing timestamps from spans would be catastrophic :)

Copy link
Member Author

Choose a reason for hiding this comment

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

We have some safety rails for this. Ideally they are so unobstrusive that we will never need to document them, but let's see :D

* `$logentry` (also applies to the `message` attribute)
* `$thread` matches a single thread instance in `{"threads": {"values": [...]}}`
* `$breadcrumb` matches a single breadcrumb in `{"breadcrumbs": [...]}`
* `$span` matches a [trace span]({% link _documentation/performance/performance-glossary.md %}#span)
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a pity that Jekyll doesn't support checking the reference within the target page, we indeed have to construct the link to #span the way it is here, and accept it may become broken without breaking the build (I admit, I don't even know if a bad {% link %} would break the build either...).

https://jekyllrb.com/docs/liquid/tags/#link

Copy link
Member Author

Choose a reason for hiding this comment

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

check out bin/link-check, unfortunately it is extremely slow as it goes over HTML output and is still Ruby

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, thanks for sharing!

@@ -117,7 +160,7 @@ Examples:
[Remove] [Anything] from [$frame.vars]
```

### Escaping Specal Characters
### Escaping Special Characters
Copy link
Contributor

Choose a reason for hiding this comment

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

I hope you don't mind I took a chance to fix an old typo here :)

@untitaker untitaker merged commit bc65d8c into master Mar 20, 2020
@untitaker untitaker deleted the ref/explain-selectors-better branch March 20, 2020 19:01
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants