From b2a5badc535717079789a44505e4a57056b7f427 Mon Sep 17 00:00:00 2001 From: Katerina Date: Wed, 28 May 2025 17:11:37 +0300 Subject: [PATCH] Update ttfmp documentation to include the recent enhancements (#213416) ## Summary Update docs for ttfmp --- .../adding_custom_performance_metrics.mdx | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/dev_docs/tutorials/performance/adding_custom_performance_metrics.mdx b/dev_docs/tutorials/performance/adding_custom_performance_metrics.mdx index b68e91b3fc6c..92c00648cad5 100644 --- a/dev_docs/tutorials/performance/adding_custom_performance_metrics.mdx +++ b/dev_docs/tutorials/performance/adding_custom_performance_metrics.mdx @@ -405,6 +405,38 @@ An event using custom metrics will be indexed with the following structure: } ``` +#### Add inline documentation + +The description metadata field is allowing teams to document how a page is instrumentented + +```typescript +... + onPageReady({ + meta: { + rangeFrom, + rangeTo, + description: '[ttfmp_dependencies] Dependencies table is ready after fetching top_dependencies.' + } + }); +... +``` + +#### Track TTFMP on refresh load + +TTFMP supports a new dimension: isInitialLoad, distinguishing between an initial page load and a refresh triggered by actions like the time picker. +This requires instrumenting `onPageRefreshStart()` when refreshing the page. + +```typescript +... + const { onPageRefreshStart } = usePerformanceContext(); + + const handleRefresh = () => { + onPageRefreshStart() + } + +... +``` + ### Development environment The metric will be delivered to the [Telemetry Staging](https://telemetry-v2-staging.elastic.dev/) cluster, alongside with the event's context.