robotframework-tracer 0.2.1__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/PKG-INFO +15 -1
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/README.md +14 -0
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/pyproject.toml +1 -1
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer/listener.py +55 -55
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer/span_builder.py +2 -2
- robotframework_tracer-0.2.3/src/robotframework_tracer/version.py +1 -0
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer.egg-info/PKG-INFO +15 -1
- robotframework_tracer-0.2.1/src/robotframework_tracer/version.py +0 -1
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/setup.cfg +0 -0
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/setup.py +0 -0
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer/__init__.py +0 -0
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer/attributes.py +0 -0
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer/config.py +0 -0
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer.egg-info/SOURCES.txt +0 -0
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer.egg-info/dependency_links.txt +0 -0
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer.egg-info/requires.txt +0 -0
- {robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: robotframework-tracer
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: OpenTelemetry distributed tracing for Robot Framework
|
|
5
5
|
Author: Robot Framework Tracer Contributors
|
|
6
6
|
License: Apache-2.0
|
|
@@ -108,9 +108,23 @@ docker run -d --name jaeger \
|
|
|
108
108
|
### 2. Run your tests with the listener
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
|
+
# Basic usage (uses default endpoint localhost:4318)
|
|
111
112
|
robot --listener robotframework_tracer.TracingListener tests/
|
|
113
|
+
|
|
114
|
+
# With environment variables (recommended for custom endpoints)
|
|
115
|
+
export OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318/v1/traces
|
|
116
|
+
export OTEL_SERVICE_NAME=my-tests
|
|
117
|
+
robot --listener robotframework_tracer.TracingListener tests/
|
|
118
|
+
|
|
119
|
+
# With inline options (colon-separated key=value pairs)
|
|
120
|
+
robot --listener "robotframework_tracer.TracingListener:service_name=my-tests:capture_logs=true" tests/
|
|
121
|
+
|
|
122
|
+
# With custom endpoint (URL colons are automatically handled)
|
|
123
|
+
robot --listener "robotframework_tracer.TracingListener:endpoint=http://jaeger:4318/v1/traces:service_name=my-tests" tests/
|
|
112
124
|
```
|
|
113
125
|
|
|
126
|
+
> **Note:** Robot Framework splits listener arguments on `:`. Use colons to separate options. URLs containing `://` are automatically reconstructed.
|
|
127
|
+
|
|
114
128
|
### 3. View traces
|
|
115
129
|
|
|
116
130
|
Open http://localhost:16686 in your browser to see your test traces in Jaeger UI.
|
|
@@ -71,9 +71,23 @@ docker run -d --name jaeger \
|
|
|
71
71
|
### 2. Run your tests with the listener
|
|
72
72
|
|
|
73
73
|
```bash
|
|
74
|
+
# Basic usage (uses default endpoint localhost:4318)
|
|
74
75
|
robot --listener robotframework_tracer.TracingListener tests/
|
|
76
|
+
|
|
77
|
+
# With environment variables (recommended for custom endpoints)
|
|
78
|
+
export OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318/v1/traces
|
|
79
|
+
export OTEL_SERVICE_NAME=my-tests
|
|
80
|
+
robot --listener robotframework_tracer.TracingListener tests/
|
|
81
|
+
|
|
82
|
+
# With inline options (colon-separated key=value pairs)
|
|
83
|
+
robot --listener "robotframework_tracer.TracingListener:service_name=my-tests:capture_logs=true" tests/
|
|
84
|
+
|
|
85
|
+
# With custom endpoint (URL colons are automatically handled)
|
|
86
|
+
robot --listener "robotframework_tracer.TracingListener:endpoint=http://jaeger:4318/v1/traces:service_name=my-tests" tests/
|
|
75
87
|
```
|
|
76
88
|
|
|
89
|
+
> **Note:** Robot Framework splits listener arguments on `:`. Use colons to separate options. URLs containing `://` are automatically reconstructed.
|
|
90
|
+
|
|
77
91
|
### 3. View traces
|
|
78
92
|
|
|
79
93
|
Open http://localhost:16686 in your browser to see your test traces in Jaeger UI.
|
{robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer/listener.py
RENAMED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import platform
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
import robot
|
|
1
5
|
from opentelemetry import trace
|
|
2
6
|
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter as HTTPExporter
|
|
3
|
-
from opentelemetry.
|
|
7
|
+
from opentelemetry.propagate import inject
|
|
8
|
+
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
|
|
4
9
|
from opentelemetry.sdk.trace import TracerProvider
|
|
5
10
|
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
6
|
-
from opentelemetry.sdk.trace.sampling import
|
|
11
|
+
from opentelemetry.sdk.trace.sampling import ParentBased, TraceIdRatioBased
|
|
7
12
|
from opentelemetry.semconv.resource import ResourceAttributes
|
|
8
|
-
from opentelemetry.propagate import inject
|
|
9
|
-
import platform
|
|
10
|
-
import sys
|
|
11
|
-
import robot
|
|
12
13
|
|
|
13
14
|
from .config import TracerConfig
|
|
14
15
|
from .span_builder import SpanBuilder
|
|
@@ -37,57 +38,20 @@ class TracingListener:
|
|
|
37
38
|
|
|
38
39
|
ROBOT_LISTENER_API_VERSION = 3
|
|
39
40
|
|
|
40
|
-
def __init__(
|
|
41
|
-
self,
|
|
42
|
-
endpoint=None,
|
|
43
|
-
service_name=None,
|
|
44
|
-
protocol=None,
|
|
45
|
-
capture_arguments=None,
|
|
46
|
-
max_arg_length=None,
|
|
47
|
-
capture_logs=None,
|
|
48
|
-
sample_rate=None,
|
|
49
|
-
span_prefix_style=None,
|
|
50
|
-
log_level=None,
|
|
51
|
-
max_log_length=None,
|
|
52
|
-
):
|
|
41
|
+
def __init__(self, *args, **kwargs):
|
|
53
42
|
"""Initialize the tracing listener.
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
sample_rate: Sampling rate (0.0-1.0)
|
|
63
|
-
span_prefix_style: Span prefix style (none, text, emoji)
|
|
64
|
-
log_level: Minimum log level to capture (DEBUG, INFO, WARN, ERROR)
|
|
65
|
-
max_log_length: Maximum length for log messages
|
|
44
|
+
Accepts arguments in multiple formats:
|
|
45
|
+
- Environment variables (recommended): OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME
|
|
46
|
+
- Keyword arguments: endpoint=..., service_name=...
|
|
47
|
+
- RF listener args: key=value pairs (comma-separated)
|
|
48
|
+
|
|
49
|
+
Note: Robot Framework splits listener arguments on ':' which breaks URLs.
|
|
50
|
+
This listener automatically reconstructs URLs that were split.
|
|
66
51
|
"""
|
|
67
|
-
|
|
68
|
-
kwargs
|
|
69
|
-
|
|
70
|
-
kwargs["endpoint"] = endpoint
|
|
71
|
-
if service_name is not None:
|
|
72
|
-
kwargs["service_name"] = service_name
|
|
73
|
-
if protocol is not None:
|
|
74
|
-
kwargs["protocol"] = protocol
|
|
75
|
-
if capture_arguments is not None:
|
|
76
|
-
kwargs["capture_arguments"] = capture_arguments
|
|
77
|
-
if max_arg_length is not None:
|
|
78
|
-
kwargs["max_arg_length"] = max_arg_length
|
|
79
|
-
if capture_logs is not None:
|
|
80
|
-
kwargs["capture_logs"] = capture_logs
|
|
81
|
-
if sample_rate is not None:
|
|
82
|
-
kwargs["sample_rate"] = sample_rate
|
|
83
|
-
if span_prefix_style is not None:
|
|
84
|
-
kwargs["span_prefix_style"] = span_prefix_style
|
|
85
|
-
if log_level is not None:
|
|
86
|
-
kwargs["log_level"] = log_level
|
|
87
|
-
if max_log_length is not None:
|
|
88
|
-
kwargs["max_log_length"] = max_log_length
|
|
89
|
-
|
|
90
|
-
self.config = TracerConfig(**kwargs)
|
|
52
|
+
parsed_kwargs = self._parse_listener_args(args)
|
|
53
|
+
parsed_kwargs.update(kwargs)
|
|
54
|
+
self.config = TracerConfig(**parsed_kwargs)
|
|
91
55
|
|
|
92
56
|
# Initialize OpenTelemetry with automatic resource detection
|
|
93
57
|
resource_attrs = {
|
|
@@ -130,6 +94,42 @@ class TracingListener:
|
|
|
130
94
|
self.tracer = trace.get_tracer(__name__)
|
|
131
95
|
self.span_stack = []
|
|
132
96
|
|
|
97
|
+
@staticmethod
|
|
98
|
+
def _parse_listener_args(args):
|
|
99
|
+
"""Parse Robot Framework listener arguments.
|
|
100
|
+
|
|
101
|
+
RF splits arguments on ':' and passes each as a separate arg.
|
|
102
|
+
Example: 'listener:endpoint=http://host:4318:service_name=test'
|
|
103
|
+
becomes args = ('endpoint=http', '//host', '4318', 'service_name=test')
|
|
104
|
+
|
|
105
|
+
This method reconstructs URLs and parses key=value pairs.
|
|
106
|
+
"""
|
|
107
|
+
if not args:
|
|
108
|
+
return {}
|
|
109
|
+
|
|
110
|
+
kwargs = {}
|
|
111
|
+
i = 0
|
|
112
|
+
while i < len(args):
|
|
113
|
+
arg = args[i]
|
|
114
|
+
|
|
115
|
+
if "=" in arg:
|
|
116
|
+
key, value = arg.split("=", 1)
|
|
117
|
+
# Check if value is start of a URL that got split
|
|
118
|
+
if value in ("http", "https") and i + 1 < len(args) and args[i + 1].startswith("//"):
|
|
119
|
+
# Reconstruct URL: scheme + :// + rest
|
|
120
|
+
url_parts = [value]
|
|
121
|
+
i += 1
|
|
122
|
+
while i < len(args) and "=" not in args[i]:
|
|
123
|
+
url_parts.append(args[i])
|
|
124
|
+
i += 1
|
|
125
|
+
kwargs[key.strip()] = ":".join(url_parts)
|
|
126
|
+
continue
|
|
127
|
+
else:
|
|
128
|
+
kwargs[key.strip()] = value.strip()
|
|
129
|
+
i += 1
|
|
130
|
+
|
|
131
|
+
return kwargs
|
|
132
|
+
|
|
133
133
|
def _set_trace_context_variables(self):
|
|
134
134
|
"""Set Robot Framework variables with current trace context."""
|
|
135
135
|
if not BUILTIN_AVAILABLE:
|
|
@@ -170,7 +170,7 @@ class TracingListener:
|
|
|
170
170
|
if headers.get("tracestate"):
|
|
171
171
|
builtin.set_test_variable("${TRACESTATE}", headers["tracestate"])
|
|
172
172
|
|
|
173
|
-
except Exception
|
|
173
|
+
except Exception:
|
|
174
174
|
# Silently ignore errors to avoid breaking tests
|
|
175
175
|
pass
|
|
176
176
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from opentelemetry import trace, baggage
|
|
2
|
-
from opentelemetry.trace import Status, StatusCode
|
|
3
1
|
import robot
|
|
2
|
+
from opentelemetry import baggage, trace
|
|
3
|
+
from opentelemetry.trace import Status, StatusCode
|
|
4
4
|
|
|
5
5
|
from .attributes import AttributeExtractor, RFAttributes
|
|
6
6
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.3"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: robotframework-tracer
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: OpenTelemetry distributed tracing for Robot Framework
|
|
5
5
|
Author: Robot Framework Tracer Contributors
|
|
6
6
|
License: Apache-2.0
|
|
@@ -108,9 +108,23 @@ docker run -d --name jaeger \
|
|
|
108
108
|
### 2. Run your tests with the listener
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
|
+
# Basic usage (uses default endpoint localhost:4318)
|
|
111
112
|
robot --listener robotframework_tracer.TracingListener tests/
|
|
113
|
+
|
|
114
|
+
# With environment variables (recommended for custom endpoints)
|
|
115
|
+
export OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318/v1/traces
|
|
116
|
+
export OTEL_SERVICE_NAME=my-tests
|
|
117
|
+
robot --listener robotframework_tracer.TracingListener tests/
|
|
118
|
+
|
|
119
|
+
# With inline options (colon-separated key=value pairs)
|
|
120
|
+
robot --listener "robotframework_tracer.TracingListener:service_name=my-tests:capture_logs=true" tests/
|
|
121
|
+
|
|
122
|
+
# With custom endpoint (URL colons are automatically handled)
|
|
123
|
+
robot --listener "robotframework_tracer.TracingListener:endpoint=http://jaeger:4318/v1/traces:service_name=my-tests" tests/
|
|
112
124
|
```
|
|
113
125
|
|
|
126
|
+
> **Note:** Robot Framework splits listener arguments on `:`. Use colons to separate options. URLs containing `://` are automatically reconstructed.
|
|
127
|
+
|
|
114
128
|
### 3. View traces
|
|
115
129
|
|
|
116
130
|
Open http://localhost:16686 in your browser to see your test traces in Jaeger UI.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.1"
|
|
File without changes
|
|
File without changes
|
{robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer/__init__.py
RENAMED
|
File without changes
|
{robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer/attributes.py
RENAMED
|
File without changes
|
{robotframework_tracer-0.2.1 → robotframework_tracer-0.2.3}/src/robotframework_tracer/config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|