-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat(metrics): Rename all metrics extracted by relay [INGEST-548] #30472
Conversation
@priscilawebdev or @matejminar could I please ask one of you to make the same changes on the front end? Basically just change the metric name for every API request in Performance from e.g. |
sure @jjbayer I'll do it 😉 |
@@ -470,28 +471,28 @@ class SnubaField: | |||
) | |||
|
|||
_METRICS = { | |||
"session": { | |||
SessionMetricKey.SESSION.value: { |
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 would recommend here not adding the .value
and just using the enum
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 like the idea, but this dict also contains metric names that are not session metrics, so I think we should stick with strings here.
size-limit report
|
@@ -258,7 +257,7 @@ def get_values( | |||
started = int(data_points[key]) | |||
abnormal = int(data_points.get(replace(key, raw_session_status="abnormal"), 0)) | |||
crashed = int(data_points.get(replace(key, raw_session_status="crashed"), 0)) | |||
errored_key = replace(key, metric_name="session.error", raw_session_status=None) | |||
errored_key = replace(key, metric_name=MetricKey.SESSION_ERROR, raw_session_status=None) |
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.
Should this be a .value
?
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 changed the type of metric_name
to MetricKey
, but did not to rename the variable itself. Renamed to metric_key
now to make it more clear.
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.
@priscilawebdev Thank you for your contribution! I tested it locally and everything works as expected. Could you please review my latest commit? I accidentally added the wrong prefix to transaction.duration
so I fixed that now, and renamed MeasurementMetric
to TransactionMetric
in the process.
static/app/utils/metrics/fields.tsx
Outdated
|
||
export const METRICS: Readonly<Record<SessionMetric | TransactionMetric, ColumnType>> = { | ||
// Session metrics | ||
[TransactionMetric.TRANSACTION_DURATION]: 'duration', |
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.
@jjbayer can you confirm that the types are correct here?
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.
They look correct, the tricky thing is that count(transaction.duration)
is actually an integer, while avg(transaction.duration)
, p95(transaction.duration)
etc. are durations.
@@ -710,7 +717,7 @@ describe('Performance > Widgets > WidgetContainer', function () { | |||
'p50 Duration' | |||
); | |||
|
|||
expect(wrapper.find('HighlightNumber').text()).toEqual('51s'); | |||
expect(wrapper.find('HighlightNumber').text()).toEqual('534ms'); |
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.
Why is this assertion updated? I thought this is only renaming stuff, did some logic change?
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.
yes this part of the code was updated
sentry/static/app/views/performance/landing/widgets/transforms/transformMetricsToArea.tsx
Line 87 in 6f110da
: mean(serie.data.map(({value}) => value)); |
static/app/utils/metrics/fields.tsx
Outdated
TRANSACTION_DURATION = 'sentry.transactions.transaction.duration', | ||
} | ||
|
||
export const METRICS: Readonly<Record<SessionMetric | TransactionMetric, ColumnType>> = { |
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.
Exported METRICS variable is very generic, can we please rename it to something more descriptive? Like METRIC_TO_COLUMN_TYPE.
static/app/utils/metrics/fields.tsx
Outdated
|
||
export const METRICS: Readonly<Record<SessionMetric | TransactionMetric, ColumnType>> = { | ||
// Session metrics | ||
[TransactionMetric.TRANSACTION_DURATION]: 'duration', |
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.
Should this one be moved to the Transaction metrics group below?
static/app/utils/metrics/fields.tsx
Outdated
SESSION = 'sentry.sessions.session', | ||
SESSION_DURATION = 'sentry.sessions.session.duration', | ||
SESSION_ERROR = 'sentry.sessions.session.error', | ||
USER = 'sentry.sessions.user', | ||
} | ||
|
||
export enum TransactionMetric { | ||
MEASUREMENTS_FP = 'sentry.transactions.measurements.fp', | ||
MEASUREMENTS_FCP = 'sentry.transactions.measurements.fcp', | ||
MEASUREMENTS_LCP = 'sentry.transactions.measurements.lcp', | ||
MEASUREMENTS_FID = 'sentry.transactions.measurements.fid', | ||
MEASUREMENTS_CLS = 'sentry.transactions.measurements.cls', |
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.
nit: Would be nice to have prefixes sentry.sessions
and sentry.transactions
as a constant.
@@ -542,7 +539,7 @@ def _flatten_data(org_id: int, data: _SnubaDataByMetric) -> _DataPoints: | |||
if raw_session_status is not None: | |||
raw_session_status = _reverse_resolve_ensured(raw_session_status) | |||
flat_key = _DataPointKey( | |||
metric_name=metric_name, | |||
metric_key=metric_name, |
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.
Maybe rename here the metric_name
to metric_key
then
As in getsentry/relay#1147, prefix all metric names with either
sentry.sessions.
orsentry.transactions.
.