mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[APM] fixes incorrect values in service overview throughput chart (#89348)
* [APM] fixes incorrect values in service overview throughput chart
This commit is contained in:
parent
7465976c25
commit
8e57b63deb
2 changed files with 37 additions and 32 deletions
|
@ -27,12 +27,17 @@ interface Options {
|
|||
|
||||
type ESResponse = PromiseReturnType<typeof fetcher>;
|
||||
|
||||
function transform(response: ESResponse) {
|
||||
function transform(response: ESResponse, options: Options) {
|
||||
const { end, start } = options.setup;
|
||||
const deltaAsMinutes = (end - start) / 1000 / 60;
|
||||
if (response.hits.total.value === 0) {
|
||||
return [];
|
||||
}
|
||||
const buckets = response.aggregations?.throughput.buckets ?? [];
|
||||
return buckets.map(({ key: x, doc_count: y }) => ({ x, y }));
|
||||
return buckets.map(({ key: x, doc_count: y }) => ({
|
||||
x,
|
||||
y: y / deltaAsMinutes,
|
||||
}));
|
||||
}
|
||||
|
||||
async function fetcher({
|
||||
|
@ -82,6 +87,6 @@ async function fetcher({
|
|||
|
||||
export async function getThroughput(options: Options) {
|
||||
return {
|
||||
throughput: transform(await fetcher(options)),
|
||||
throughput: transform(await fetcher(options), options),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607435880000,
|
||||
"y": 4,
|
||||
"y": 0.133333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607435910000,
|
||||
|
@ -16,7 +16,7 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607435940000,
|
||||
"y": 2,
|
||||
"y": 0.0666666666666667,
|
||||
},
|
||||
Object {
|
||||
"x": 1607435970000,
|
||||
|
@ -24,11 +24,11 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607436000000,
|
||||
"y": 3,
|
||||
"y": 0.1,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436030000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436060000,
|
||||
|
@ -40,7 +40,7 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607436120000,
|
||||
"y": 4,
|
||||
"y": 0.133333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436150000,
|
||||
|
@ -56,7 +56,7 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607436240000,
|
||||
"y": 6,
|
||||
"y": 0.2,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436270000,
|
||||
|
@ -68,15 +68,15 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607436330000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436360000,
|
||||
"y": 5,
|
||||
"y": 0.166666666666667,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436390000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436420000,
|
||||
|
@ -88,11 +88,11 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607436480000,
|
||||
"y": 2,
|
||||
"y": 0.0666666666666667,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436510000,
|
||||
"y": 5,
|
||||
"y": 0.166666666666667,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436540000,
|
||||
|
@ -104,11 +104,11 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607436600000,
|
||||
"y": 2,
|
||||
"y": 0.0666666666666667,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436630000,
|
||||
"y": 7,
|
||||
"y": 0.233333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436660000,
|
||||
|
@ -124,7 +124,7 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607436750000,
|
||||
"y": 2,
|
||||
"y": 0.0666666666666667,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436780000,
|
||||
|
@ -132,15 +132,15 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607436810000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436840000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436870000,
|
||||
"y": 2,
|
||||
"y": 0.0666666666666667,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436900000,
|
||||
|
@ -152,11 +152,11 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607436960000,
|
||||
"y": 2,
|
||||
"y": 0.0666666666666667,
|
||||
},
|
||||
Object {
|
||||
"x": 1607436990000,
|
||||
"y": 4,
|
||||
"y": 0.133333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437020000,
|
||||
|
@ -168,11 +168,11 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607437080000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437110000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437140000,
|
||||
|
@ -184,15 +184,15 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607437200000,
|
||||
"y": 2,
|
||||
"y": 0.0666666666666667,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437230000,
|
||||
"y": 7,
|
||||
"y": 0.233333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437260000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437290000,
|
||||
|
@ -200,11 +200,11 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607437320000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437350000,
|
||||
"y": 2,
|
||||
"y": 0.0666666666666667,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437380000,
|
||||
|
@ -216,11 +216,11 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607437440000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437470000,
|
||||
"y": 3,
|
||||
"y": 0.1,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437500000,
|
||||
|
@ -232,7 +232,7 @@ Array [
|
|||
},
|
||||
Object {
|
||||
"x": 1607437560000,
|
||||
"y": 1,
|
||||
"y": 0.0333333333333333,
|
||||
},
|
||||
Object {
|
||||
"x": 1607437590000,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue