Skip to main content

OpenTelemetry distributed tracing for Robot Framework

Project description

Robot Framework Tracer

OpenTelemetry distributed tracing integration for Robot Framework test execution.

What is this?

robotframework-tracer is a Robot Framework listener plugin that automatically creates distributed traces for your test execution using OpenTelemetry. It captures the complete test hierarchy (suites → tests → keywords) as spans and exports them to any OpenTelemetry-compatible backend like Jaeger, Grafana Tempo, or Zipkin.

This enables you to:

  • Visualize test execution flow with detailed timing information
  • Debug test failures by examining the complete execution trace
  • Analyze performance and identify slow keywords or tests
  • Correlate tests with application traces in distributed systems
  • Monitor test execution across CI/CD pipelines
  • Propagate trace context to your System Under Test (SUT)

Robot Framework Trace Visualization

How it works

The tracer implements the Robot Framework Listener v3 API and creates OpenTelemetry spans for each test execution phase:

Suite Span (root)
├── Test Case Span
│   ├── Keyword Span
│   │   └── Nested Keyword Span
│   └── Keyword Span
└── Test Case Span
    └── Keyword Span

Each span includes rich metadata: test names, tags, status (PASS/FAIL), timing, arguments, and error details.

Installation

From PyPI (when released)

pip install robotframework-tracer

From Source (Development)

# Clone the repository
git clone <repository-url>
cd robotframework-tracer

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e ".[dev]"

See docs/DEVELOPMENT.md for detailed development setup instructions.

Quick Start

1. Start a tracing backend (Jaeger example)

docker run -d --name jaeger \
  -p 16686:16686 \
  -p 4318:4318 \
  jaegertracing/all-in-one:latest

2. Run your tests with the listener

robot --listener robotframework_tracer.TracingListener tests/

3. View traces

Open http://localhost:16686 in your browser to see your test traces in Jaeger UI.

Trace Context Propagation

The tracer automatically makes trace context available as Robot Framework variables for propagating to your System Under Test:

*** Test Cases ***
Test API With Distributed Tracing
    # HTTP headers automatically include trace context
    ${response}=    POST    http://my-sut/api
    ...    json={"data": "test"}
    ...    headers=${TRACE_HEADERS}
    
    # For custom protocols, use individual components
    ${diameter_msg}=    Create Diameter Request
    ...    trace_id=${TRACE_ID}
    ...    span_id=${SPAN_ID}

Available variables:

  • ${TRACE_HEADERS} - HTTP headers dictionary
  • ${TRACE_ID} - 32-character hex trace ID
  • ${SPAN_ID} - 16-character hex span ID
  • ${TRACEPARENT} - W3C traceparent header
  • ${TRACESTATE} - W3C tracestate header

See docs/trace-propagation.md for complete examples.

Configuration

Basic usage

robot --listener robotframework_tracer.TracingListener tests/

Custom endpoint

robot --listener robotframework_tracer.TracingListener:endpoint=http://jaeger:4318/v1/traces tests/

Custom service name

robot --listener "robotframework_tracer.TracingListener:endpoint=http://jaeger:4318/v1/traces,service_name=my-tests" tests/

All configuration options

robot --listener "robotframework_tracer.TracingListener:\
endpoint=http://localhost:4318/v1/traces,\
service_name=robot-tests,\
protocol=http,\
capture_arguments=true,\
max_arg_length=200" tests/

Environment variables

export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
export OTEL_SERVICE_NAME=robot-framework-tests
robot --listener robotframework_tracer.TracingListener tests/

Configuration Options

Option Default Description
endpoint http://localhost:4318/v1/traces OTLP endpoint URL
service_name rf Service name in traces
protocol http Protocol: http or grpc
span_prefix_style none Span prefix style: none, text, emoji
capture_arguments true Capture keyword arguments
max_arg_length 200 Max length for arguments
capture_logs false Capture log messages as events
log_level INFO Minimum log level (DEBUG, INFO, WARN, ERROR)
max_log_length 500 Max length for log messages
sample_rate 1.0 Sampling rate (0.0-1.0, 1.0 = no sampling)

Span Attributes

Each span includes relevant Robot Framework metadata:

Suite spans:

  • rf.suite.name - Suite name
  • rf.suite.source - Suite file path
  • rf.suite.id - Suite ID
  • rf.version - Robot Framework version

Test spans:

  • rf.test.name - Test case name
  • rf.test.id - Test ID
  • rf.test.tags - Test tags
  • rf.status - PASS/FAIL/SKIP
  • rf.elapsed_time - Execution time

Keyword spans:

  • rf.keyword.name - Keyword name
  • rf.keyword.type - SETUP/TEARDOWN/KEYWORD
  • rf.keyword.library - Library name
  • rf.keyword.args - Arguments (if enabled)
  • rf.status - PASS/FAIL

Supported Backends

Works with any OpenTelemetry-compatible backend:

  • Jaeger - Open source tracing platform
  • Grafana Tempo - High-scale distributed tracing
  • Zipkin - Distributed tracing system
  • AWS X-Ray - AWS distributed tracing
  • Honeycomb - Observability platform
  • Datadog - Monitoring and analytics

See docs/backends.md for backend-specific setup guides.

Requirements

  • Python 3.8+
  • Robot Framework 6.0+
  • OpenTelemetry SDK

Documentation

Examples

See the examples/ directory for complete examples:

  • Basic usage with Jaeger
  • Advanced configuration
  • CI/CD integration
  • Multiple backend setups

Contributing

Contributions are welcome! Please see docs/CONTRIBUTING.md for guidelines.

License

Apache License 2.0 - See docs/LICENSE for details.

Status

Current Version: v0.2.0
Status: Production-ready with trace propagation

Core functionality is complete and tested. See docs/CHANGELOG.md for version history and docs/IMPLEMENTATION_PLAN.md for the development roadmap.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework_tracer-0.2.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotframework_tracer-0.2.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_tracer-0.2.0.tar.gz.

File metadata

  • Download URL: robotframework_tracer-0.2.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for robotframework_tracer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fc1716bb9f594562e4f589c0cab1ce021590c8a23cc0cb01bf3f18efa6ad2141
MD5 0499d664b2d483248679af15c537c5bd
BLAKE2b-256 6971168ede543faac2a40a907e36516ee26297f50c8f7beffcd23f3b7b40360e

See more details on using hashes here.

File details

Details for the file robotframework_tracer-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_tracer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31d93893e21f096972523ca5c5847c71a68ccb722649edd491b8cc5ccf8dfa4f
MD5 37bd1ac7ca177b6d64474a3d95ddb61b
BLAKE2b-256 365f4208dee455c382b661ccc1ba0d847c5e184cc55d1ea36a2dac776f9e84b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page