[APM] Set minimum bucket size to connect dots in metric chart (#34473)

This commit is contained in:
Søren Louv-Jansen 2019-04-09 09:33:58 +02:00 committed by GitHub
parent 47e97532ed
commit 0eff2e15f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 6 deletions

View file

@ -56,7 +56,7 @@ Array [
"min": 100,
},
"field": "@timestamp",
"interval": "1s",
"interval": "30s",
"min_doc_count": 0,
},
},

View file

@ -34,7 +34,7 @@ interface Aggs {
export type ESResponse = PromiseReturnType<typeof fetch>;
export async function fetch({ serviceName, setup }: MetricsRequestArgs) {
const { start, end, esFilterQuery, client, config } = setup;
const { intervalString } = getBucketSize(start, end, 'auto');
const { bucketSize } = getBucketSize(start, end, 'auto');
const filters: ESFilter[] = [
{ term: { [SERVICE_NAME]: serviceName } },
{ term: { [PROCESSOR_EVENT]: 'metric' } },
@ -56,7 +56,9 @@ export async function fetch({ serviceName, setup }: MetricsRequestArgs) {
timeseriesData: {
date_histogram: {
field: '@timestamp',
interval: intervalString,
// ensure minimum bucket size of 30s since this is the default resolution for metric data
interval: `${Math.max(bucketSize, 30)}s`,
min_doc_count: 0,
extended_bounds: { min: start, max: end }
},

View file

@ -48,7 +48,7 @@ Array [
"min": 100,
},
"field": "@timestamp",
"interval": "1s",
"interval": "30s",
"min_doc_count": 0,
},
},

View file

@ -30,7 +30,7 @@ interface Aggs {
export type ESResponse = PromiseReturnType<typeof fetch>;
export async function fetch({ serviceName, setup }: MetricsRequestArgs) {
const { start, end, esFilterQuery, client, config } = setup;
const { intervalString } = getBucketSize(start, end, 'auto');
const { bucketSize } = getBucketSize(start, end, 'auto');
const filters: ESFilter[] = [
{ term: { [SERVICE_NAME]: serviceName } },
{ term: { [PROCESSOR_EVENT]: 'metric' } },
@ -59,7 +59,9 @@ export async function fetch({ serviceName, setup }: MetricsRequestArgs) {
timeseriesData: {
date_histogram: {
field: '@timestamp',
interval: intervalString,
// ensure minimum bucket size of 30s since this is the default resolution for metric data
interval: `${Math.max(bucketSize, 30)}s`,
min_doc_count: 0,
extended_bounds: { min: start, max: end }
},