otlp-test-data 0.11.2__tar.gz → 0.11.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: otlp-test-data
3
- Version: 0.11.2
3
+ Version: 0.11.3
4
4
  Summary: Produces OTLP data using OTEL instrumentation
5
5
  Project-URL: Repository, https://github.com/dimaqq/otlp-test-data
6
6
  Project-URL: Issues, https://github.com/dimaqq/otlp-test-data/issues
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
  import base64
4
4
  import dataclasses
5
5
  import json
6
+ import logging
6
7
  import random
7
8
  from typing import Sequence, TYPE_CHECKING
8
9
  from typing_extensions import reveal_type as reveal_type # temp
@@ -114,6 +115,14 @@ def workload():
114
115
  attribute_types()
115
116
  repeated_attributes()
116
117
  events()
118
+ instrumentation_scopes()
119
+ with_exception()
120
+ with_logs()
121
+ # TODO: status that's not an OK status
122
+ # TODO: captured logs
123
+ # TODO: example exception traceback
124
+ # TODO: instrumentation scope with a version
125
+ # TODO: instrumentation scope with attributes
117
126
 
118
127
 
119
128
  def series_of_spans():
@@ -138,26 +147,76 @@ def outer():
138
147
 
139
148
 
140
149
  @tracer.start_as_current_span("inner")
141
- def inner():
150
+ def inner() -> None:
142
151
  opentelemetry.trace.get_current_span().set_attribute("an-attribute", 42)
143
152
  time.tick()
144
153
 
145
154
 
155
+ @tracer.start_as_current_span("with-exc-outer")
156
+ def with_exception() -> None:
157
+ try:
158
+ with tracer.start_as_current_span("with-exc-inner"):
159
+ 1 / 0 # type: ignore
160
+ except Exception:
161
+ pass
162
+
163
+
164
+ @tracer.start_as_current_span("with-logs")
165
+ def with_logs() -> None:
166
+ logging.warning("sss")
167
+ time.tick()
168
+ logging.warning("sss-sss")
169
+ time.tick()
170
+ logging.warning("sss-sss-sss")
171
+
172
+
146
173
  def attribute_types():
147
174
  with tracer.start_as_current_span("attribute-types") as span:
148
175
  span.set_attributes(
149
- {"int": 42, "bool": False, "float": 3.14, "str": "string-cheese"}
176
+ {"int": 42, "bool": False, "float": 3.14, "str": "cheese", "bytes": b"bb"}
150
177
  )
151
178
  span.set_attributes(
152
179
  {
153
180
  "ints": [1, 42],
154
181
  "bools": [True, False],
155
182
  "floats": [2.72, 3.14],
156
- "strs": ["string-cheese", "strung-cheese"],
183
+ "strs": ["cheese", "mozzarella"],
184
+ "byteses": [b"aa", b"bb"], # type: ignore
157
185
  }
158
186
  )
159
187
 
160
188
 
189
+ def instrumentation_scopes():
190
+ tracer1 = opentelemetry.trace.get_tracer("one", "1.2.3")
191
+ tracer2 = opentelemetry.trace.get_tracer("one", "2.7.18")
192
+ tracer3 = opentelemetry.trace.get_tracer(
193
+ "one",
194
+ "3.14.0a5",
195
+ attributes={
196
+ "bool": True,
197
+ "int": 42,
198
+ "float": -12.34,
199
+ "string": "cheese",
200
+ "bytes": b"bb",
201
+ "empty-list": [],
202
+ "empty-dict": {}, # type: ignore
203
+ },
204
+ )
205
+
206
+ with tracer1.start_as_current_span("1.1"):
207
+ time.tick()
208
+ with tracer2.start_as_current_span("2.1"):
209
+ time.tick()
210
+ with tracer1.start_as_current_span("1.2"):
211
+ time.tick()
212
+ with tracer1.start_as_current_span("1.3"):
213
+ time.tick()
214
+ with tracer3.start_as_current_span("3.1"):
215
+ time.tick()
216
+ with tracer1.start_as_current_span("1.4"):
217
+ time.tick()
218
+
219
+
161
220
  def repeated_attributes():
162
221
  with tracer.start_as_current_span("attribute-types") as span:
163
222
  span.set_attribute("int", 42)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "otlp-test-data"
3
- version = "0.11.2"
3
+ version = "0.11.3"
4
4
  description = "Produces OTLP data using OTEL instrumentation"
5
5
  requires-python = ">=3.8"
6
6
  # https://github.com/astral-sh/uv/issues/4204
@@ -374,7 +374,7 @@ wheels = [
374
374
 
375
375
  [[package]]
376
376
  name = "otlp-test-data"
377
- version = "0.10.0"
377
+ version = "0.11.3"
378
378
  source = { editable = "." }
379
379
  dependencies = [
380
380
  { name = "freezegun" },