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

ref(dashboards): Simplify TimeSeries field meta #86834

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gggritso
Copy link
Member

@gggritso gggritso commented Mar 11, 2025

There is an incoming re-write of the /events-stats/ endpoint, which will include a new and much nicer data output format. This PR start to align with that format with one very nice simplification, of what the meta field looks like. Since TimeSeries is already a transformed type (we make it from EventsStats, usually) we can make changes to it in preparation for the API to return TimeSeries straight, eventually. Plus these changes are good and useful, and make the code simpler.

Contributes to https://github.com/getsentry/team-performance/issues/58

Before:

{
  "meta": {
    "fields": {
      "eps()": "rate"
    },
    "units": {
      "eps()": "1/second"
    }
  }
}

This format is very awkward, because you have to go digging through the meta to find the type and unit. This can be very annoying if you don't know what the field was, because that information wasn't passed along. This is even more annoying because in TimeSeries, if its ever renamed, we have to also rename the fields in the meta, so they match the field. Yikes.

After:

{
  "meta": {
    "type": "rate",
    "unit": "1/second"
  }
}

This is much more sensible. No need to go digging for types and units, no need to rename anything. Since almost all the code is going through convertSeriesToTimeSeries I didn't even have to change much, mostly mocks and stories.

I'm tired of this union all over the place
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 11, 2025
@gggritso gggritso marked this pull request as ready for review March 11, 2025 20:43
@gggritso gggritso requested review from a team as code owners March 11, 2025 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant