getsentry / getsentry/sentry

Support custom tag value comparisons (numbers, dates)

Open
#104,977 4 comments 2 reactions 0 assignees View on GitHub
Feature Product Area: Issues
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
22h 21m
Merged PRs (30d)
586

Description

### Problem Statement

I have some custom tags whose values are numbers that I would like to be able to use the comparison operators (`<`, `>=`, etc) on when filtering events/issues in Sentry.

> For example, an auto-incrementing build number, or maybe the number of users in a customer's organization, or whatever else.

I also have a custom tag whose value is a JS `Date` / ISO8601 timestamp string that I would like to do things like "has a tag whose time value is after X".

> For example, I want to send the server the date that a JS build was built at so I can search for events from newer builds than a certain timestamp.

This is not possible right now. It seems that only some built-in tags (e.g. `event.timestamp`) can be used this way. All custom tags are parsed as strings.

I want to do this from the Sentry dashboard, but it also doesn't work in the API (tried both).

Context links:

[https://docs.sentry.io/concepts/search/#comparison-operators]()
[https://sentry.zendesk.com/hc/en-us/articles/23699651636763-How-do-I-search-for-events-in-a-time-range]()

### Solution Brainstorm

Several possible ways to do this, some are more backwards-compatible than others I'm sure

* Just let SDKs inspect tag values for their type, and take numbers in as numbers instead of strings.
* Accept `Date` objects (in JS, for example) and/or treat strings that match the ISO 8601 (e.g. JS `Date.toISOString()`) as timestamps and treat them the same way you treat `event.timestamp`
* Have a new way to tell the SDKs what type a tag should be interpreted as (string being the default if not specifiied)

### Product Area

Unknown

Contributor guide

Open the contributing guide

Research direction

Read the comparison-operators documentation linked in the issue and reproduce the limitation in the Sentry dashboard and API. Then scope how custom tag values should be typed, including numeric and ISO8601 values, with completion defined as consistent comparisons in both interfaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
api, search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.