-
Notifications
You must be signed in to change notification settings - Fork 8.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
[APM] Alerting: Show preview as chart of threshold #84080
Conversation
b7a8c39
to
fd50aa5
Compare
|
||
// Make the maximum Y value either the actual max or 20% more than the threshold | ||
const values = data.map((d) => d.y ?? 0); | ||
const yMax = Math.max(Math.max(...values), threshold * 1.2); |
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.
could be simplified to Math.max(...values, threshold * 1.2);
Pinging @elastic/apm-ui (Team:apm) |
const thresholdOpacity = 0.3; | ||
const timestamps = data.map((d) => d.x); | ||
const xMin = moment.utc(getMax(timestamps)).valueOf(); | ||
const xMax = moment.utc(getMin(timestamps)).valueOf(); |
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.
Is moment needed? it seems like getMax(timestamps)
& getMin(timestamps)
would be sufficient.
@@ -14,7 +14,7 @@ import { i18n } from '@kbn/i18n'; | |||
import React, { useState } from 'react'; | |||
import { IBasePath } from '../../../../../../src/core/public'; | |||
import { AlertType } from '../../../common/alert_types'; | |||
import { AlertingFlyout } from '../../components/alerting/AlertingFlyout'; | |||
import { AlertingFlyout } from '../../components/alerting/alerting_flyout'; |
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.
👍
x-pack/plugins/apm/public/components/alerting/chart_preview/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/alerting/chart_preview/index.tsx
Outdated
Show resolved
Hide resolved
|
||
import datemath from '@elastic/datemath'; | ||
|
||
export function windowToTimeRange(windowSize: number, windowUnit: string) { |
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.
windowToTimeRange
seems a little vague. WDYT about getAbsoluteTimeRange
?
export function windowToTimeRange(windowSize: number, windowUnit: string) { | |
export function getAbsoluteTimeRange(windowSize: number, windowUnit: string) { |
x-pack/plugins/apm/public/components/alerting/error_count_alert_trigger/index.tsx
Show resolved
Hide resolved
const chartPreview = ( | ||
<ChartPreview | ||
data={data} | ||
yTickFormat={(d: any) => asPercent(d, 1)} |
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.
Can we narrow the type?
yTickFormat={(d: any) => asPercent(d, 1)} | |
yTickFormat={(d: number) => asPercent(d, 1)} |
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.
Agreed. It's taking a y value so probably number | null
is better.
x-pack/plugins/apm/server/lib/alerts/chart_preview/get_transaction_duration.ts
Show resolved
Hide resolved
bool: { | ||
filter: [ | ||
{ range: rangeFilter(start, end) }, | ||
, |
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.
extra comma?
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Distributable file count
History
To update your PR or re-run it, just comment with: |
import { useEnvironmentsFetcher } from '../../../hooks/use_environments_fetcher'; | ||
import { callApmApi } from '../../../services/rest/createCallApmApi'; | ||
import { getResponseTimeTickFormatter } from '../../shared/charts/transaction_charts/helper'; | ||
import { useFormatter } from '../../shared/charts/transaction_charts/use_formatter'; |
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.
Reverting this PR, will post updates shortly. |
This reverts commit 9986aff.
Reverted due to failure in master. master: d909a96 There was a conflict with a line added to this PR that referenced a file removed in a PR merged an hour prior. #84080 (comment) |
closes #77313