Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Fix condition to use
serviceTransactionMetric
documents (#180903
) closes #167578 (#167578 (comment)) ## Summary This PR fixes when `/time_range_metadata` returns `hasDocs=true` for `serviceTransactionMetric` to make sure the UI doesn't lose information by querying `serviceTransactionMetric` docs in a range where docs from APM < 8.7 still exists. **IMPORTANT** ❗ Based on the APM Server [changelog](https://github.com/elastic/apm-server/blob/bbf4eb276bee1deb29ad65a3ab79ac31a482f03d/changelogs/8.7.asciidoc#L71) and this [issue](elastic/apm-server#9703), `serviceTransactionMetric` doc was added in 8.7 as well as the aggregations by `10m` and `60m` intervals for `transaction` docs. In `8.7`, the `transaction.duration.summary` was also introduced, therefore the new rollup interval docs will always contain the new field. Based on that, the logic was changed to - Verify whether `transaction` `10m` and `60m` are supported within a given time range - Verify whether or not `transaction.duration.summary` is supported for `transaction` `1m` docs - All other doc types and intervals are presupposed to support `transaction.duration.summary` ### Range starting from when there is no data (contains docs generated by APM < 8.7 and APM >= 8.7) <img width="1210" alt="image" src="https://github.com/elastic/kibana/assets/2767137/d7767d28-03ef-4f5a-b10c-b8529d9b0f69"> ```json { "isUsingServiceDestinationMetrics": false, "sources": [ { "documentType": "serviceTransactionMetric", "rollupInterval": "1m", "hasDocs": false, "hasDurationSummaryField": false }, { "documentType": "serviceTransactionMetric", "rollupInterval": "10m", "hasDocs": false, "hasDurationSummaryField": false }, { "documentType": "serviceTransactionMetric", "rollupInterval": "60m", "hasDocs": false, "hasDurationSummaryField": false }, { "documentType": "transactionMetric", "rollupInterval": "1m", "hasDocs": true, "hasDurationSummaryField": false }, { "documentType": "transactionMetric", "rollupInterval": "10m", "hasDocs": true, "hasDurationSummaryField": false }, { "documentType": "transactionMetric", "rollupInterval": "60m", "hasDocs": true, "hasDurationSummaryField": false }, { "documentType": "transactionEvent", "rollupInterval": "none", "hasDocs": true, "hasDurationSummaryField": false } ] } ``` ### Range starting from when first docs were ingested (contains docs generated by APM < 8.7 and APM >= 8.7) <img width="1208" alt="image" src="https://github.com/elastic/kibana/assets/2767137/982f2359-fb20-4bf8-8d9a-afbb1cd5b0ea"> ```json { "isUsingServiceDestinationMetrics": false, "sources": [ { "documentType": "serviceTransactionMetric", "rollupInterval": "1m", "hasDocs": false, "hasDurationSummaryField": false }, { "documentType": "serviceTransactionMetric", "rollupInterval": "10m", "hasDocs": false, "hasDurationSummaryField": false }, { "documentType": "serviceTransactionMetric", "rollupInterval": "60m", "hasDocs": false, "hasDurationSummaryField": false }, { "documentType": "transactionMetric", "rollupInterval": "1m", "hasDocs": true, "hasDurationSummaryField": false }, { "documentType": "transactionMetric", "rollupInterval": "10m", "hasDocs": true, "hasDurationSummaryField": false }, { "documentType": "transactionMetric", "rollupInterval": "60m", "hasDocs": true, "hasDurationSummaryField": false }, { "documentType": "transactionEvent", "rollupInterval": "none", "hasDocs": true, "hasDurationSummaryField": false } ] } ``` ### Range starting from when only APM >= 8.7 docs exist <img width="1198" alt="image" src="https://github.com/elastic/kibana/assets/2767137/3a972457-3a0a-440d-85a1-add8a48f37d1"> ```json { "isUsingServiceDestinationMetrics": false, "sources": [ { "documentType": "serviceTransactionMetric", "rollupInterval": "1m", "hasDocs": true, "hasDurationSummaryField": true }, { "documentType": "serviceTransactionMetric", "rollupInterval": "10m", "hasDocs": true, "hasDurationSummaryField": true }, { "documentType": "serviceTransactionMetric", "rollupInterval": "60m", "hasDocs": true, "hasDurationSummaryField": true }, { "documentType": "transactionMetric", "rollupInterval": "1m", "hasDocs": true, "hasDurationSummaryField": false }, { "documentType": "transactionMetric", "rollupInterval": "10m", "hasDocs": true, "hasDurationSummaryField": false }, { "documentType": "transactionMetric", "rollupInterval": "60m", "hasDocs": true, "hasDurationSummaryField": false }, { "documentType": "transactionEvent", "rollupInterval": "none", "hasDocs": true, "hasDurationSummaryField": false } ] } ``` ### How to tests Generate docs without ServiceTransactionMetrics ```bash node scripts/synthtrace service_summary_field_version_dependent.ts --versionOverride=8.6.2 --from=now-2h --to=now --clean ``` Generate docs with ServiceTransactionMetrics ```bash node scripts/synthtrace service_summary_field_version_dependent.ts --from=now-1h --to=now ``` Follow the same steps from above. --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information