Skip to content

[8.x] [Performance] Refactor TTFMP query from, to fields (#213911)#217090

Merged
awahab07 merged 9 commits intoelastic:8.xfrom
awahab07:backport/8.x/pr-213911
Apr 7, 2025
Merged

[8.x] [Performance] Refactor TTFMP query from, to fields (#213911)#217090
awahab07 merged 9 commits intoelastic:8.xfrom
awahab07:backport/8.x/pr-213911

Conversation

@awahab07
Copy link
Contributor

@awahab07 awahab07 commented Apr 3, 2025

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

Currently Kibana forwards `query_range_secs` and `query_offset_secs` to
mark the selected time range when reporting TTFMP event. This format
caused some challenges to identify `from`, `to` date offsets in
visualizations.

To simplify, the PR renames and sends the three fields explicitly:
- `query_from_offset_secs` offset to `0` (now), with -ve for past and
+ve for future dates
- `query_to_offset_secs` offset to `0` (now), with -ve for past and +ve
for future dates
- `query_range_secs`                      same as previously sent

_This approach is followed after a discussion, and based on the
[gist](https://gist.github.com/andrewvc/1f04a57a336d768e4ec5ff2eff06ba54)
excerpt:_

```
Earliest date -> QueryFrom
Newest date -> QueryTo
Duration -> QueryRange
```

### Indexing
These fields then should be mapped in the EBT indexer to ingest in the
top level of the document, eventually removing the need to create
runtime fields in data views for visualizations.

Also, runtime fields in data views should be updated to reflect this
change. For backward compatibility, the runtime fields can cater both
the old and new field names conditionally.

### Testing
- Ensure that the TTFMP events are correctly reporting the date ranges.

### Example

![image](https://github.com/user-attachments/assets/529507fc-66f7-440a-8bbb-b34176e8d093)

(cherry picked from commit e6e78ac)

# Conflicts:
#	src/core/packages/analytics/browser-internal/src/track_performance_measure_entries.test.ts
#	src/core/packages/analytics/browser-internal/src/track_performance_measure_entries.ts
#	src/platform/packages/shared/kbn-ebt-tools/src/performance_metrics/context/measure_interaction/index.ts
#	src/platform/packages/shared/kbn-ebt-tools/src/performance_metrics/context/measure_interaction/measure_interaction.test.tsx
@awahab07 awahab07 requested a review from kibanamachine as a code owner April 3, 2025 18:09
@awahab07 awahab07 added the backport This PR is a backport of another PR label Apr 3, 2025
@awahab07 awahab07 enabled auto-merge (squash) April 3, 2025 18:09
@botelastic botelastic bot added the Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. label Apr 3, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #5 / TemplatesList calls onDeleteTemplate correctly

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/ebt-tools 29 30 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 2.6MB 2.6MB +68.0B
infra 1.6MB 1.6MB +321.0B
total +389.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 441.2KB 441.6KB +350.0B
kbnUiSharedDeps-srcJs 3.6MB 3.6MB +38.0B
total +388.0B
Unknown metric groups

API count

id before after diff
@kbn/ebt-tools 38 39 +1

ESLint disabled line counts

id before after diff
@kbn/core-analytics-browser-internal 8 9 +1

Total ESLint disabled count

id before after diff
@kbn/core-analytics-browser-internal 8 9 +1

History

@awahab07 awahab07 requested a review from a team April 7, 2025 09:49
Copy link
Contributor

@kpatticha kpatticha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@awahab07 awahab07 merged commit a6e6edd into elastic:8.x Apr 7, 2025
8 checks passed
@awahab07
Copy link
Contributor Author

awahab07 commented Apr 7, 2025

LGTM but out of curiosity why this PR doesn't include this change https://github.com/elastic/kibana/pull/217091/files#diff-2f6ac913521496dfe30f85e2ee5ddd4b18d17835de823b6550fce778d10a9202R15

similar to 8.18 and 9

@kpatticha
There's a difference in tests and context under https://github.com/elastic/kibana/tree/8.x/x-pack/solutions/observability/plugins/apm/public between 8.x vs. 8.18 and 9.0, so 8.x didn't need it whereas for 8.18 and 9.0, tests would fail without the mock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants