Skip to content

Commit

Permalink
Make service map initial load time range configurable with
Browse files Browse the repository at this point in the history
`xpack.apm.serviceMapInitialTimeRange` default to last 1 hour in
milliseconds
  • Loading branch information
ogupte committed Jan 8, 2020
1 parent b1c38e7 commit 2ca87d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion x-pack/legacy/plugins/apm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export const apm: LegacyPluginInitializer = kibana => {
autocreateApmIndexPattern: Joi.boolean().default(true),

// service map
serviceMapEnabled: Joi.boolean().default(false)
serviceMapEnabled: Joi.boolean().default(false),
serviceMapInitialTimeRange: Joi.number().default(60 * 1000 * 60) // last 1 hour
}).default();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ export async function getTraceSampleIds({
}) {
const isTop = !after;

const { start, end, client, indices, uiFiltersES } = setup;
const { start, end, client, indices, uiFiltersES, config } = setup;

const rangeEnd = end;
const rangeStart = isTop ? Math.max(rangeEnd - 60 * 1000 * 60) : start;
const rangeStart = isTop
? rangeEnd - config['xpack.apm.serviceMapInitialTimeRange']
: start;

const rangeQuery = { range: rangeFilter(rangeStart, rangeEnd) };

Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/apm/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const config = {
},
schema: schema.object({
serviceMapEnabled: schema.boolean({ defaultValue: false }),
serviceMapInitialTimeRange: schema.number({ defaultValue: 60 * 1000 * 60 }), // last 1 hour
autocreateApmIndexPattern: schema.boolean({ defaultValue: true }),
ui: schema.object({
enabled: schema.boolean({ defaultValue: true }),
Expand All @@ -37,6 +38,7 @@ export function mergeConfigs(apmOssConfig: APMOSSConfig, apmConfig: APMXPackConf
'apm_oss.onboardingIndices': apmOssConfig.onboardingIndices,
'apm_oss.indexPattern': apmOssConfig.indexPattern,
'xpack.apm.serviceMapEnabled': apmConfig.serviceMapEnabled,
'xpack.apm.serviceMapInitialTimeRange': apmConfig.serviceMapInitialTimeRange,
'xpack.apm.ui.enabled': apmConfig.ui.enabled,
'xpack.apm.ui.maxTraceItems': apmConfig.ui.maxTraceItems,
'xpack.apm.ui.transactionGroupBucketSize': apmConfig.ui.transactionGroupBucketSize,
Expand Down

0 comments on commit 2ca87d1

Please sign in to comment.