Git Product home page Git Product logo

tracing-selenium-grid's Introduction

tracing-selenium-grid

TL;DR: A simple project to showcase Selenium 4's Tracing capability using OpenTelemetry APIs(Jaeger) with Selenium Grid.

Observability

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. It's 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,

  • Root cause analysis
  • Performance optimisation
  • dependency analysis of services

Selenium-4

It has 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 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:

  1. Code instrumentation: Adding instrumentation code in your application to produce traces. The major instrumentation parts are done neatly by the developers of Selenium project, which leaves us to consume it by using Selenium Grid start-up command along with Jaeger.

  2. Collection of data and providing meaning over it, Jaeger has a UI which allows us to view traces visually well.

Steps to start tracing your tests,

  • Start Jaeger via docker(as its easy)

  • Instrument your Selenium Grid start-up command with Jaeger tracing as in start-grid-distributed.sh and start-grid-standalone.sh for standalone mode.

  • Now execute your tests tests, and navigate to http://localhost:16686/ to view the outputs.

Pre-requisites

Assuming you have java and docker running on your machine,

  1. Install Jaeger via docker
  2. Selenium-server.jar refers to the latest alpha version of selenium releases (Tested with Alpha 5)

Start Jaeger via docker server

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.

Instrument your Selenium Grid command

The startup scripts use maven to download opentelemetry-exporter-otlp and transitive dependencies to ./target/dependency. This folder is added to Selenium Server's 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

Grid status

Execute your tests

./mvnw test

This will execute the SeleniumGridTest Class. Navigate to http://localhost:16686/ to view the resulting traces in Jaeger.

Under services look up for selenium-router and notice actions for each call made by your tests. An example below

Traces

References:

A special thanks to ever helpful Simon Stewart for being patience in answering my dumb questions.

tracing-selenium-grid's People

Contributors

krmahadevan avatar manoj9788 avatar pujagani avatar tylerbenson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tracing-selenium-grid's Issues

Tracking HTTP communication from browser to server

We are considering load tests using Selenium.

I want to get the details of the HTTP request sent from Chrome to the server.

According to the verification, the HTTP request to be sent from the browser to the server was not obtained.

Do you know how to track browser processing?

I followed this tutorial and got tracing setup

I followed this tutorial and got tracing setup but it does not show in Jaeger when I searched it under services. It only shows jaeger-query and selenium-route didn't display when I searched under services. What can I do? Very urgent as we need this tracing.

using dockers and kubernetes

Hey,

I want to add jaeger tracing,
i ran the jaeger all in one solution container inside the minikube with ingressbundy-grid.com at port 14250
but i can't see any traces,
i am missing this part

--ext $(coursier fetch -p
io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0
io.grpc:grpc-netty:1.35.0)

how can i replace this so it will work with dockers and kubernetes ?

this is my current yaml env setup:

- name: SE_OPTS value: --log-level INFO --structured-logs true - name: JAVA_OPTS value: -Dotel.traces.exporter=jaeger -Dotel.exporter.jaeger.endpoint=bundy-grid.com:14250 -Dotel.resource.attributes=service.name=selenium-chrome-node

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.