-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(explore): Add Heat Map widget to Explore metrics #115608
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
Open
gggritso
wants to merge
9
commits into
master
Choose a base branch
from
georgegritsouk/dain-1635-add-heat-map-widget-to-explore-ii
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
138cfd3
feat(explore): Add Heat Map widget to Explore metrics
gggritso 0226d5c
fix(explore): Use tooltipProps on trigger button for disabled dropdowns
gggritso 038d3e2
fix(explore): Compute heatmap Y buckets from measured container dimen…
gggritso 206c7ee
fix(explore): Merge metric unit into heatmap Y-axis meta
gggritso f4dfc0c
Merge remote-tracking branch 'origin/master' into georgegritsouk/dain…
gggritso 95eb559
fix(explore): Fix heatmap error state and misplaced import
gggritso ea6d705
fix(explore): Fix TS errors in heatmap select and unit types
gggritso 5c1a3f0
fix(explore): Fall back to timeseries when heatmap flag is off
gggritso 3c07e5b
fix(explore): Enforce count() aggregate and clear groupBy for heatmap
gggritso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
static/app/views/explore/metrics/hooks/metricHeatmapApiOptions.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import {skipToken} from '@tanstack/react-query'; | ||
|
|
||
| import {normalizeDateTimeParams} from 'sentry/components/pageFilters/parse'; | ||
| import type {PageFilters} from 'sentry/types/core'; | ||
| import type {Organization} from 'sentry/types/organization'; | ||
| import {defined} from 'sentry/utils'; | ||
| import {apiOptions} from 'sentry/utils/api/apiOptions'; | ||
| import {DiscoverDatasets} from 'sentry/utils/discover/types'; | ||
| import {intervalToMilliseconds} from 'sentry/utils/duration/intervalToMilliseconds'; | ||
| import type {HeatMapSeries} from 'sentry/views/dashboards/widgets/common/types'; | ||
| import type {TraceMetric} from 'sentry/views/explore/metrics/metricQuery'; | ||
| import {createTraceMetricEventsFilter} from 'sentry/views/explore/metrics/utils'; | ||
|
|
||
| interface MetricHeatmapApiOptions { | ||
| enabled: boolean; | ||
| interval: string; | ||
| organization: Organization; | ||
| query: string; | ||
| selection: PageFilters; | ||
| traceMetric: TraceMetric; | ||
| yBuckets: number; | ||
| } | ||
|
|
||
| export function metricHeatmapApiOptions({ | ||
| traceMetric, | ||
| enabled, | ||
| organization, | ||
| selection, | ||
| query, | ||
| interval, | ||
| yBuckets, | ||
| }: MetricHeatmapApiOptions) { | ||
| const traceMetricFilter = createTraceMetricEventsFilter([traceMetric]); | ||
| const combinedQuery = query ? `${traceMetricFilter} ${query}` : traceMetricFilter; | ||
|
|
||
| const intervalInMilliseconds = intervalToMilliseconds(interval); | ||
| const {start, end, period} = normalizeDateTimeParams(selection.datetime); | ||
| const usesRelativeDateRange = !defined(start) && !defined(end) && defined(period); | ||
|
|
||
| return apiOptions.as<HeatMapSeries>()( | ||
| '/organizations/$organizationIdOrSlug/events-heatmap/', | ||
| { | ||
| path: enabled ? {organizationIdOrSlug: organization.slug} : skipToken, | ||
| query: { | ||
| dataset: DiscoverDatasets.TRACEMETRICS, | ||
| xAxis: 'time', | ||
| yAxis: 'value', | ||
| zAxis: 'count()', | ||
| yBuckets, | ||
| interval, | ||
| query: combinedQuery, | ||
| project: selection.projects, | ||
| environment: selection.environments, | ||
| start, | ||
| end, | ||
| ...(period ? {statsPeriod: period} : {}), | ||
| referrer: 'api.explore.tracemetrics-heatmap', | ||
| }, | ||
| staleTime: | ||
| usesRelativeDateRange && intervalInMilliseconds !== 0 | ||
| ? intervalInMilliseconds | ||
| : Infinity, | ||
| } | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm getting a bunch of 500s when hitting this endpoint (on the vercel deploy) but not too sure what it is 🤔