-
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] Adds support for metrics for latency distribution histogram #136083
Changes from 2 commits
c048f32
84433a4
432183b
45275a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,23 @@ | ||||||||||||||||||||||||||||||||
/* | ||||||||||||||||||||||||||||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||||||||||||||||||||||||||||||||
* or more contributor license agreements. Licensed under the Elastic License | ||||||||||||||||||||||||||||||||
* 2.0; you may not use this file except in compliance with the Elastic License | ||||||||||||||||||||||||||||||||
* 2.0. | ||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
import { | ||||||||||||||||||||||||||||||||
SPAN_DURATION, | ||||||||||||||||||||||||||||||||
TRANSACTION_DURATION, | ||||||||||||||||||||||||||||||||
TRANSACTION_DURATION_HISTOGRAM, | ||||||||||||||||||||||||||||||||
} from '../../../../common/elasticsearch_fieldnames'; | ||||||||||||||||||||||||||||||||
import { ProcessorEvent } from '../../../../common/processor_event'; | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
export function getDurationField(eventType: ProcessorEvent) { | ||||||||||||||||||||||||||||||||
if (eventType === ProcessorEvent.metric) { | ||||||||||||||||||||||||||||||||
return TRANSACTION_DURATION_HISTOGRAM; | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This new util function was just some code cleanup since we had repeated switching logic to for the duration field between the latency distribution chart and the correlations distribution charts. If the abstractions were to change, we would want to tease apart the correlations from the regular latency distribution chart (1st tab vs 2nd & 3rd tabs) into distinct functions for their own use cases. We could consider this tech debt and out of scope for this bug fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue is that |
||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
if (eventType === ProcessorEvent.span) { | ||||||||||||||||||||||||||||||||
return SPAN_DURATION; | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
return TRANSACTION_DURATION; | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could have used a switch here, couldn't you? Up to you to do this change though!
Suggested change
|
||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import { termQuery } from '@kbn/observability-plugin/server'; | |
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; | ||
import { getOverallLatencyDistribution } from './get_overall_latency_distribution'; | ||
import { setupRequest } from '../../lib/helpers/setup_request'; | ||
import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; | ||
import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; | ||
import { environmentRt, kueryRt, rangeRt } from '../default_api_types'; | ||
import { | ||
|
@@ -61,9 +62,18 @@ const latencyOverallTransactionDistributionRoute = createApmServerRoute({ | |
termFilters, | ||
} = resources.params.body; | ||
|
||
const searchAggregatedTransactions = await getSearchAggregatedTransactions({ | ||
...setup, | ||
kuery, | ||
start, | ||
end, | ||
}); | ||
|
||
return getOverallLatencyDistribution({ | ||
setup, | ||
eventType: ProcessorEvent.transaction, | ||
eventType: searchAggregatedTransactions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this is enough. I think you also need a filter for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The call to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It only checks for the existence. The actual search itself needs a filter on |
||
? ProcessorEvent.metric | ||
: ProcessorEvent.transaction, | ||
environment, | ||
kuery, | ||
start, | ||
|
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 think you can delete this.