Observability and Selenium
June 19, 2020
(Updated on July 13, 2023)
It is a measure of how well internal states of a system can be inferred from knowledge of its external outputs. It helps bring visibility into systems. – Wikipedia
Tracing is one of the important pillars for measuring observability along with logs and metrics. Its a way of thinking about the system, a way of being able to ask the system questions, that you need the answer to when you didn't know the questions beforehand. On the other hand, alerting is a way of asking questions when you do know the question beforehand.
Distributed Tracing can be quite helpful in answering questions for your distributed system like,
It has a number of new exciting features and one such is a cleaner code for Selenium Grid along with support for distributed tracing via OpenTelemetry APIs. This is a pretty exciting and important feature for the admins and DevOps engineers to trace the flow of control through the Grid for each and every command.
Distributed tracing has two parts:
Steps to start tracing your tests,
Assuming you have docker running on your machine,
The simplest way to start the all-in-one is to use the pre-built image published to DockerHub (a single command line).
$ docker run --rm -it --name jaeger \ -p 16686:16686 \ -p 14250:14250 \ jaegertracing/all-in-one:1.17
You can then navigate to http://localhost:16686 to access the Jaeger UI.
We're going to add support for Open Telemetry API's(one of the many ways to do distributed tracing) using Coursier to generate a full classpath when started this way the selenium server will inform you that it has found a tracer on stdout.
Refer start-grid-distributed.sh if you want to start Grid in distributed mode.
curl http://localhost:4444/status
to check if your grid deployment is ready
Point your tests as in DistributedTracingExamples Class and navigate to http://localhost:16686/ to view the outputs.
Under services lookup for Selenium-router and notices actions for each call made by your tests. An example below
References:
A special thanks to ever-helpful Simon Stewart
More articles
If you enjoyed this article, you'll find these insightful too!
