Skip to content

[APM] Make sure telemetry queries are scoped and have a timeout #143819

@dgieselaar

Description

@dgieselaar

Once every twelve hours, we sequentially run a set of queries server-side (with the internal user) to collect telemetry about APM data. We should make sure that these queries only consider relevant data for performance and privacy reasons, and that they're guarded with a timeout. Right now this is not always the case. E.g., the cardinality task queries all indices, making it a relatively (and unnecessarily) expensive request. We should make both index and timeout required in the client type that is passed down to the telemetry tasks, to prevent this situation from occurring.

name: 'cardinality',
executor: async ({ search }) => {
const allAgentsCardinalityResponse = await search({
body: {
size: 0,
timeout,
query: {
bool: {
filter: [range1d],
},
},
aggs: {
[TRANSACTION_NAME]: {
cardinality: {
field: TRANSACTION_NAME,
},
},
[USER_AGENT_ORIGINAL]: {
cardinality: {
field: USER_AGENT_ORIGINAL,
},
},
},
},
});
const rumAgentCardinalityResponse = await search({

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions