otlp-test-data 0.11.3__tar.gz → 0.12.0__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.
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/PKG-INFO +1 -1
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/otlp_test_data/__init__.py +17 -1
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/pyproject.toml +1 -1
- otlp_test_data-0.12.0/test/test_smoke.py +40 -0
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/uv.lock +25 -25
- otlp_test_data-0.11.3/test/test_smoke.py +0 -15
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/.github/workflows/ci.yaml +0 -0
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/.github/workflows/psr.yaml +0 -0
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/.gitignore +0 -0
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/.pre-commit-config.yaml +0 -0
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/changelog.md +0 -0
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/otlp_test_data/py.typed +0 -0
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/readme.md +0 -0
- {otlp_test_data-0.11.3 → otlp_test_data-0.12.0}/test/test_repeatable.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: otlp-test-data
|
|
3
|
-
Version: 0.
|
|
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
|
|
@@ -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
|
|
@@ -105,6 +115,12 @@ def _proto_to_json(data: Message) -> bytes:
|
|
|
105
115
|
"SPAN_KIND_PRODUCER": 4,
|
|
106
116
|
"SPAN_KIND_CONSUMER": 5,
|
|
107
117
|
}[sp["kind"]]
|
|
118
|
+
if status := sp["status"]:
|
|
119
|
+
status["code"] = {
|
|
120
|
+
"STATUS_CODE_UNSET": 0,
|
|
121
|
+
"STATUS_CODE_OK": 1,
|
|
122
|
+
"STATUS_CODE_ERROR": 2,
|
|
123
|
+
}[status["code"]]
|
|
108
124
|
|
|
109
125
|
return json.dumps(dic).encode("utf-8")
|
|
110
126
|
|
|
@@ -199,7 +215,7 @@ def instrumentation_scopes():
|
|
|
199
215
|
"string": "cheese",
|
|
200
216
|
"bytes": b"bb",
|
|
201
217
|
"empty-list": [],
|
|
202
|
-
"empty-dict": {}, #
|
|
218
|
+
# "empty-dict": {}, # not allowed for instrumentation scopes
|
|
203
219
|
},
|
|
204
220
|
)
|
|
205
221
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from otlp_test_data import sample_proto, sample_spans, sample_json
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_spans():
|
|
7
|
+
assert sample_spans()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_sample_json():
|
|
11
|
+
data = sample_json()
|
|
12
|
+
assert json.loads(data)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_no_enum_labels():
|
|
16
|
+
data = sample_json()
|
|
17
|
+
# Ensure that all enum labels have been converted to ints
|
|
18
|
+
assert b"SPAN_KIND_" not in data
|
|
19
|
+
assert b"SPAN_FLAGS_" not in data
|
|
20
|
+
assert b"STATUS_CODE_" not in data
|
|
21
|
+
# Metrics
|
|
22
|
+
assert b"AGGREGATION_TEMPORALITY_" not in data
|
|
23
|
+
assert b"DATA_POINT_FLAGS_" not in data
|
|
24
|
+
# Logs
|
|
25
|
+
assert b"SEVERITY_NUMBER_" not in data
|
|
26
|
+
assert b"LOG_RECORD_FLAGS_" not in data
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_logging_integration():
|
|
30
|
+
data = sample_json()
|
|
31
|
+
assert b"sss-sss-sss" in data
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_exceptions():
|
|
35
|
+
data = sample_json()
|
|
36
|
+
assert b"Traceback" in data
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_proto():
|
|
40
|
+
assert sample_proto()
|
|
@@ -374,7 +374,7 @@ wheels = [
|
|
|
374
374
|
|
|
375
375
|
[[package]]
|
|
376
376
|
name = "otlp-test-data"
|
|
377
|
-
version = "0.
|
|
377
|
+
version = "0.12.0"
|
|
378
378
|
source = { editable = "." }
|
|
379
379
|
dependencies = [
|
|
380
380
|
{ name = "freezegun" },
|
|
@@ -447,15 +447,15 @@ wheels = [
|
|
|
447
447
|
|
|
448
448
|
[[package]]
|
|
449
449
|
name = "pyright"
|
|
450
|
-
version = "1.1.
|
|
450
|
+
version = "1.1.395"
|
|
451
451
|
source = { registry = "https://pypi.org/simple" }
|
|
452
452
|
dependencies = [
|
|
453
453
|
{ name = "nodeenv" },
|
|
454
454
|
{ name = "typing-extensions" },
|
|
455
455
|
]
|
|
456
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
456
|
+
sdist = { url = "https://files.pythonhosted.org/packages/fb/47/a2e1dfd70f9f0db34f70d5b108c82be57bf24185af69c95acff57f9239fa/pyright-1.1.395.tar.gz", hash = "sha256:53703169068c160bfb41e1b44ba3e2512492869c26cfad927e1268cb3fbb1b1c", size = 3813566 }
|
|
457
457
|
wheels = [
|
|
458
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
458
|
+
{ url = "https://files.pythonhosted.org/packages/5f/a1/531897f8caa6c6cc99862cd1c908ddd8a366a51d968e83ab4523ded98b30/pyright-1.1.395-py3-none-any.whl", hash = "sha256:f9bc726870e740c6c77c94657734d90563a3e9765bb523b39f5860198ed75eef", size = 5688787 },
|
|
459
459
|
]
|
|
460
460
|
|
|
461
461
|
[[package]]
|
|
@@ -505,27 +505,27 @@ wheels = [
|
|
|
505
505
|
|
|
506
506
|
[[package]]
|
|
507
507
|
name = "ruff"
|
|
508
|
-
version = "0.9.
|
|
509
|
-
source = { registry = "https://pypi.org/simple" }
|
|
510
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
511
|
-
wheels = [
|
|
512
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
513
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
514
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
515
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
516
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
517
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
518
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
519
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
520
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
521
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
522
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
523
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
524
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
525
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
526
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
527
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
528
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
508
|
+
version = "0.9.9"
|
|
509
|
+
source = { registry = "https://pypi.org/simple" }
|
|
510
|
+
sdist = { url = "https://files.pythonhosted.org/packages/6f/c3/418441a8170e8d53d05c0b9dad69760dbc7b8a12c10dbe6db1e1205d2377/ruff-0.9.9.tar.gz", hash = "sha256:0062ed13f22173e85f8f7056f9a24016e692efeea8704d1a5e8011b8aa850933", size = 3717448 }
|
|
511
|
+
wheels = [
|
|
512
|
+
{ url = "https://files.pythonhosted.org/packages/bc/c3/2c4afa9ba467555d074b146d9aed0633a56ccdb900839fb008295d037b89/ruff-0.9.9-py3-none-linux_armv6l.whl", hash = "sha256:628abb5ea10345e53dff55b167595a159d3e174d6720bf19761f5e467e68d367", size = 10027252 },
|
|
513
|
+
{ url = "https://files.pythonhosted.org/packages/33/d1/439e58487cf9eac26378332e25e7d5ade4b800ce1eec7dc2cfc9b0d7ca96/ruff-0.9.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b6cd1428e834b35d7493354723543b28cc11dc14d1ce19b685f6e68e07c05ec7", size = 10840721 },
|
|
514
|
+
{ url = "https://files.pythonhosted.org/packages/50/44/fead822c38281ba0122f1b76b460488a175a9bd48b130650a6fb6dbcbcf9/ruff-0.9.9-py3-none-macosx_11_0_arm64.whl", hash = "sha256:5ee162652869120ad260670706f3cd36cd3f32b0c651f02b6da142652c54941d", size = 10161439 },
|
|
515
|
+
{ url = "https://files.pythonhosted.org/packages/11/ae/d404a2ab8e61ddf6342e09cc6b7f7846cce6b243e45c2007dbe0ca928a5d/ruff-0.9.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3aa0f6b75082c9be1ec5a1db78c6d4b02e2375c3068438241dc19c7c306cc61a", size = 10336264 },
|
|
516
|
+
{ url = "https://files.pythonhosted.org/packages/6a/4e/7c268aa7d84cd709fb6f046b8972313142cffb40dfff1d2515c5e6288d54/ruff-0.9.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:584cc66e89fb5f80f84b05133dd677a17cdd86901d6479712c96597a3f28e7fe", size = 9908774 },
|
|
517
|
+
{ url = "https://files.pythonhosted.org/packages/cc/26/c618a878367ef1b76270fd027ca93692657d3f6122b84ba48911ef5f2edc/ruff-0.9.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:abf3369325761a35aba75cd5c55ba1b5eb17d772f12ab168fbfac54be85cf18c", size = 11428127 },
|
|
518
|
+
{ url = "https://files.pythonhosted.org/packages/d7/9a/c5588a93d9bfed29f565baf193fe802fa676a0c837938137ea6cf0576d8c/ruff-0.9.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:3403a53a32a90ce929aa2f758542aca9234befa133e29f4933dcef28a24317be", size = 12133187 },
|
|
519
|
+
{ url = "https://files.pythonhosted.org/packages/3e/ff/e7980a7704a60905ed7e156a8d73f604c846d9bd87deda9cabfa6cba073a/ruff-0.9.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:18454e7fa4e4d72cffe28a37cf6a73cb2594f81ec9f4eca31a0aaa9ccdfb1590", size = 11602937 },
|
|
520
|
+
{ url = "https://files.pythonhosted.org/packages/24/78/3690444ad9e3cab5c11abe56554c35f005b51d1d118b429765249095269f/ruff-0.9.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0fadfe2c88724c9617339f62319ed40dcdadadf2888d5afb88bf3adee7b35bfb", size = 13771698 },
|
|
521
|
+
{ url = "https://files.pythonhosted.org/packages/6e/bf/e477c2faf86abe3988e0b5fd22a7f3520e820b2ee335131aca2e16120038/ruff-0.9.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6df104d08c442a1aabcfd254279b8cc1e2cbf41a605aa3e26610ba1ec4acf0b0", size = 11249026 },
|
|
522
|
+
{ url = "https://files.pythonhosted.org/packages/f7/82/cdaffd59e5a8cb5b14c408c73d7a555a577cf6645faaf83e52fe99521715/ruff-0.9.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:d7c62939daf5b2a15af48abbd23bea1efdd38c312d6e7c4cedf5a24e03207e17", size = 10220432 },
|
|
523
|
+
{ url = "https://files.pythonhosted.org/packages/fe/a4/2507d0026225efa5d4412b6e294dfe54725a78652a5c7e29e6bd0fc492f3/ruff-0.9.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:9494ba82a37a4b81b6a798076e4a3251c13243fc37967e998efe4cce58c8a8d1", size = 9874602 },
|
|
524
|
+
{ url = "https://files.pythonhosted.org/packages/d5/be/f3aab1813846b476c4bcffe052d232244979c3cd99d751c17afb530ca8e4/ruff-0.9.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:4efd7a96ed6d36ef011ae798bf794c5501a514be369296c672dab7921087fa57", size = 10851212 },
|
|
525
|
+
{ url = "https://files.pythonhosted.org/packages/8b/45/8e5fd559bea0d2f57c4e12bf197a2fade2fac465aa518284f157dfbca92b/ruff-0.9.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ab90a7944c5a1296f3ecb08d1cbf8c2da34c7e68114b1271a431a3ad30cb660e", size = 11327490 },
|
|
526
|
+
{ url = "https://files.pythonhosted.org/packages/42/55/e6c90f13880aeef327746052907e7e930681f26a164fe130ddac28b08269/ruff-0.9.9-py3-none-win32.whl", hash = "sha256:6b4c376d929c25ecd6d87e182a230fa4377b8e5125a4ff52d506ee8c087153c1", size = 10227912 },
|
|
527
|
+
{ url = "https://files.pythonhosted.org/packages/35/b2/da925693cb82a1208aa34966c0f36cb222baca94e729dd22a587bc22d0f3/ruff-0.9.9-py3-none-win_amd64.whl", hash = "sha256:837982ea24091d4c1700ddb2f63b7070e5baec508e43b01de013dc7eff974ff1", size = 11355632 },
|
|
528
|
+
{ url = "https://files.pythonhosted.org/packages/31/d8/de873d1c1b020d668d8ec9855d390764cb90cf8f6486c0983da52be8b7b7/ruff-0.9.9-py3-none-win_arm64.whl", hash = "sha256:3ac78f127517209fe6d96ab00f3ba97cafe38718b23b1db3e96d8b2d39e37ddf", size = 10435860 },
|
|
529
529
|
]
|
|
530
530
|
|
|
531
531
|
[[package]]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|