[APM] Remove usage of `getDocumentTypeFilterForTransactions`
#167020 opened on Sep 22, 2023
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)