otlp-test-data 0.11.4__py3-none-any.whl → 0.12.0__py3-none-any.whl

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.
@@ -42,6 +42,13 @@ class Config:
42
42
  time: freezegun.api.FrozenDateTimeFactory = None # type: ignore
43
43
 
44
44
 
45
+ class LogsToEvents(logging.Handler):
46
+ def emit(self, record):
47
+ span = opentelemetry.trace.get_current_span()
48
+ if span and span.is_recording():
49
+ span.add_event(record.getMessage(), {"severity": record.levelname})
50
+
51
+
45
52
  def sample_proto(config: Config | None = None) -> bytes:
46
53
  return _proto_to_bytes(_spans_to_proto_object(sample_spans(config)))
47
54
 
@@ -54,6 +61,9 @@ def sample_spans(config: Config | None = None) -> Sequence[ReadableSpan]:
54
61
  """Creates and finishes two spans, then returns them as a list."""
55
62
  global time
56
63
  config = config or Config()
64
+ logging.basicConfig(level="DEBUG")
65
+ if not any(isinstance(h, LogsToEvents) for h in logging.root.handlers):
66
+ logging.root.addHandler(LogsToEvents())
57
67
  resource = Resource.create(
58
68
  attributes={
59
69
  "service.namespace": "1234-1234", # a unique id
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: otlp-test-data
3
- Version: 0.11.4
3
+ Version: 0.12.0
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
@@ -0,0 +1,5 @@
1
+ otlp_test_data/__init__.py,sha256=2pIN7_pPN92AtYDGeZUmB1PB5_bx8ca4LkM1fuEaX_M,7897
2
+ otlp_test_data/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ otlp_test_data-0.12.0.dist-info/METADATA,sha256=VQMQcLR4ZOPYAc3kcM7BfcTF4cfEp-IPO7vZkxmXrzw,2247
4
+ otlp_test_data-0.12.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
+ otlp_test_data-0.12.0.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- otlp_test_data/__init__.py,sha256=TMkh9igaySapYKpGIQpFGfkFzMiB1XYyotZOsSMoyVU,7492
2
- otlp_test_data/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- otlp_test_data-0.11.4.dist-info/METADATA,sha256=9NkybvQe02UOVFvzKoXuFHFm44v89JOP96M6xXmFDRs,2247
4
- otlp_test_data-0.11.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
- otlp_test_data-0.11.4.dist-info/RECORD,,