otlp-json 0.9.7__tar.gz → 1.0.1__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.
@@ -3,6 +3,7 @@ on:
3
3
  branches: [main]
4
4
  pull_request:
5
5
  branches: [main]
6
+ workflow_dispatch:
6
7
 
7
8
  jobs:
8
9
  ci:
@@ -10,8 +11,8 @@ jobs:
10
11
  strategy:
11
12
  fail-fast: false
12
13
  matrix:
13
- python-version: [3.8, 3.9, "3.10", 3.11, 3.12, 3.13, 3.13t, 3.14]
14
- dep-versions: [--frozen, "--resolution lowest", "--resolution highest"]
14
+ python-version: [3.8, 3.9, "3.10", 3.11, 3.12, 3.13, 3.13t, 3.14, 3.15, 3.15t]
15
+ dep-versions: [--frozen, "--resolution lowest", "--resolution highest --upgrade"]
15
16
  steps:
16
17
  - uses: actions/checkout@v4
17
18
  - uses: astral-sh/setup-uv@v5
@@ -26,6 +27,7 @@ jobs:
26
27
  uv build
27
28
 
28
29
  release:
30
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
29
31
  needs: ci
30
32
  runs-on: ubuntu-latest
31
33
  environment: release
@@ -35,9 +37,7 @@ jobs:
35
37
  steps:
36
38
  - uses: actions/checkout@v4
37
39
  - uses: astral-sh/setup-uv@v5
38
- - run: |
39
- uv build --sdist --wheel
40
- rm -vf dist/.gitignore # https://github.com/astral-sh/uv/issues/11652
40
+ - run: uv build --sdist --wheel
41
41
  - uses: pypa/gh-action-pypi-publish@release/v1
42
42
  with:
43
43
  repository-url: https://test.pypi.org/legacy/
@@ -1,6 +1,6 @@
1
1
  repos:
2
2
  - repo: git@github.com:astral-sh/ruff-pre-commit.git
3
- rev: v0.9.6
3
+ rev: v0.11.12
4
4
  hooks:
5
5
  - id: ruff
6
6
  args: [ --fix ]
@@ -1,14 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: otlp-json
3
- Version: 0.9.7
3
+ Version: 1.0.1
4
4
  Summary: 🐍Lightweight OTEL span to JSON converter, no dependencies, pure Python🐍
5
5
  Project-URL: Repository, https://github.com/dimaqq/otlp-json
6
6
  Project-URL: Issues, https://github.com/dimaqq/otlp-json/issues
7
+ License: Apache License (2.0)
7
8
  Classifier: Development Status :: 3 - Alpha
8
9
  Classifier: Framework :: OpenTelemetry
9
10
  Classifier: Framework :: OpenTelemetry :: Exporters
10
11
  Classifier: Intended Audience :: Developers
11
- Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: License :: OSI Approved :: Apache Software License
12
13
  Classifier: Natural Language :: English
13
14
  Classifier: Operating System :: OS Independent
14
15
  Classifier: Programming Language :: Python
@@ -64,13 +65,21 @@ class SomeExporter:
64
65
  - 4KB Python source
65
66
  - ?? metadata
66
67
 
67
- ### TODO(doc)
68
68
 
69
- - link to rust library
70
- - link to urllib sender
71
- - link to test vector generator
69
+ ### Testing
72
70
 
73
- ### TODO(features)
71
+ ```sh
72
+ uv sync
73
+ uv run pytest
74
+ ```
75
+
76
+ ### Links
77
+
78
+ - Test data generator: https://pypi.org/project/otlp-test-data/
79
+ - Python stdlib-only exporter: https://github.com/canonical/operator/blob/main/tracing/ops_tracing/_export.py#L141-L160
80
+ - Tiny (compiled) extension written in Rust: https://pypi.org/project/otlp-proto
81
+
82
+ ### Features
74
83
 
75
84
  - Events
76
85
  - Links
@@ -7,15 +7,15 @@ from typing import Any, TYPE_CHECKING
7
7
  if TYPE_CHECKING:
8
8
  from typing_extensions import TypeAlias
9
9
 
10
- from opentelemetry.trace import Link
11
- from opentelemetry._logs import LogRecord
12
10
  from opentelemetry.sdk.trace import ReadableSpan, Event
13
11
  from opentelemetry.sdk.resources import Resource
14
12
  from opentelemetry.sdk.util.instrumentation import InstrumentationScope
15
13
  from opentelemetry.trace.status import Status
16
14
 
17
15
  _LEAF_VALUE: TypeAlias = "str | int | float | bool" # TODO: confirm
18
- _VALUE: TypeAlias = "_LEAF_VALUE | Sequence[_LEAF_VALUE]"
16
+ _VALUE: TypeAlias = (
17
+ "_LEAF_VALUE | Sequence[_LEAF_VALUE] | Mapping[str, _LEAF_VALUE]"
18
+ )
19
19
 
20
20
 
21
21
  __all__ = [
@@ -79,7 +79,10 @@ def _resource(resource: Resource):
79
79
 
80
80
 
81
81
  def _attributes(
82
- thing: Resource | InstrumentationScope | ReadableSpan | Event | Link | LogRecord,
82
+ thing: Resource
83
+ | InstrumentationScope
84
+ | ReadableSpan
85
+ | Event, # TODO: | Link | LogRecord
83
86
  ) -> dict[str, Any]:
84
87
  rv = {"attributes": [], "dropped_attributes_count": 0}
85
88
 
@@ -1,15 +1,14 @@
1
1
  [project]
2
2
  name = "otlp-json"
3
- version = "0.9.7"
3
+ version = "1.0.1"
4
4
  description = "🐍Lightweight OTEL span to JSON converter, no dependencies, pure Python🐍"
5
5
  requires-python = ">=3.8"
6
- # https://github.com/astral-sh/uv/issues/4204
7
- # license = "MIT"
6
+ license = {text = "Apache License (2.0)"}
8
7
  readme = "readme.md"
9
8
  classifiers = [
10
9
  "Development Status :: 3 - Alpha",
11
10
  "Intended Audience :: Developers",
12
- "License :: OSI Approved :: MIT License",
11
+ "License :: OSI Approved :: Apache Software License",
13
12
  "Natural Language :: English",
14
13
  "Operating System :: OS Independent",
15
14
  "Programming Language :: Python",
@@ -44,8 +43,14 @@ dev = [
44
43
  ]
45
44
  testing = [
46
45
  "pytest ~= 8.3.4",
47
- "otlp-test-data >= 0.9.3",
46
+ "otlp-test-data >= 1.0.2",
48
47
  ]
48
+ [ tool.uv]
49
+ constraint-dependencies = [
50
+ "wrapt ~= 1.14.0; python_version >= '3.11'",
51
+ "protobuf>=6.31.0; python_version >= '3.14'",
52
+ ]
53
+ exclude-dependencies = ["grpcio"]
49
54
 
50
55
  [build-system]
51
56
  requires = ["hatchling"]
@@ -35,13 +35,21 @@ class SomeExporter:
35
35
  - 4KB Python source
36
36
  - ?? metadata
37
37
 
38
- ### TODO(doc)
39
38
 
40
- - link to rust library
41
- - link to urllib sender
42
- - link to test vector generator
39
+ ### Testing
43
40
 
44
- ### TODO(features)
41
+ ```sh
42
+ uv sync
43
+ uv run pytest
44
+ ```
45
+
46
+ ### Links
47
+
48
+ - Test data generator: https://pypi.org/project/otlp-test-data/
49
+ - Python stdlib-only exporter: https://github.com/canonical/operator/blob/main/tracing/ops_tracing/_export.py#L141-L160
50
+ - Tiny (compiled) extension written in Rust: https://pypi.org/project/otlp-proto
51
+
52
+ ### Features
45
53
 
46
54
  - Events
47
55
  - Links
@@ -17,6 +17,9 @@ def canonical(batch):
17
17
  rs["scopeSpans"].sort(key=lambda sc: sc["scope"]["name"])
18
18
  for sc in rs["scopeSpans"]:
19
19
  sc["spans"].sort(key=lambda sp: sp["spanId"])
20
+ # FIXME: opentelemetry doesn't render scope attributes, so don't compare them
21
+ # (we'll just assume that this library renders them correctly)
22
+ sc["scope"].pop("attributes", None)
20
23
 
21
24
  return batch
22
25