feat(playwright): add trace support for playwright with otel reporter #2259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
What
Tracing support for the Playwright Engine through OpenTelemetry reporter (publish-metrics plugin).
How
Spans
Tracing is implemented in 2 ways:
step
function call. (Thestep
function is provided inside thetest
object argument of the processorflow
function)framenavigated
event where the main frame'spage.url()
changes, and is active until the next main frame change, portraying the time spent on each page.Each of these spans is nested within the root scenario span, creating an individual trace per scenario/VU run.
Metrics
pageSpan
as they happen,extendedMetrics
setting is set totrue
, other metrics emitted by the engine (dominteractive
,browser.memory_used_mb
) will be set as attributes as well.uuid
is set on each spanattributes
are set in the OpenTelemetry reporter config, they will be added to all spans.Errors
In case of an error, spans
SpanStatus
is set toERROR
and anexception
is recorded on the span that contains additional info (e.g. exceptions stack trace)Configuration
Configuration is the same as for HTTP engine, when tracing is configured inside the OpenTelemetry reporter (within publish-metrics plugin) Playwright scenarios will automatically be traced.
Note
If for some reason the same test is configured with both HTTP and Playwright engine scenarios, they will both be traced, and the same is true for
metrics
. The configuration provided will be applied to both engines.Example
Example user processor
flow
function:Resulting scenario trace in Honeycomb UI:
Pre-merge checklist