elastic/kibana

[APM] Remove usage of `getDocumentTypeFilterForTransactions`

Open

#167,020 opened on Sep 22, 2023

View on GitHub
 (6 comments) (0 reactions) (0 assignees)TypeScript (8,021 forks)batch import
Team:obs-ux-infra_services - DEPRECATEDapm:service-metricsapm:transaction-metricsgood first issuetechnical debt

Repository metrics

Stars
 (19,065 stars)
PR merge metrics
 (Avg merge 1d 16h) (999 merged PRs in 30d)

Description

Background

The APM UI is able to render using several different datasets:

  • raw transaction events
  • transaction metrics
  • service transaction metrics

The metric sets are further broken into intervals: 1m, 10m and 60m.

The UI should transparently use the most suitable, available dataset. This is what GET /internal/apm/time_range_metadata is for: it will decide which datasets are available for a given time range.

Problem

Currently some APIs like GET /internal/apm/services uses the time_range_metadata API for querying whilst other APIs like GET /internal/apm/services/{serviceName}/transaction_types do not and thus perform their own logic for determining which data to query. This results in some inconsistencies and outright bugs like seen in https://github.com/elastic/sdh-apm/issues/1078 (internal).

Solution

Every API that consumes (service) transaction metrics should use the information from time range metadata API as inputs. Specifically we should remove all usages of getDocumentTypeFilterForTransactions(searchAggregatedTransactions).

In some places we also call getDocumentTypeFilterForTransactions(true). We will still need this but it should be renamed to something likegetBackwardsCompatibleDocumentTypeFilterForOneMinuteTransactionMetrics().

Related

https://github.com/elastic/sdh-apm/issues/1078 https://github.com/elastic/kibana/pull/167500 (initial implementation)

Contributor guide