partial-span-processor 0.0.1__tar.gz → 0.0.2__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.
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.2
2
+ Name: partial-span-processor
3
+ Version: 0.0.2
4
+ Summary: OTEL Python SDK extension supporting partial spans
5
+ Author-email: Mladjan Gadzic <gadzic.mladjan@gmail.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/mladjan-gadzic/partial-span-processor
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.13
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: opentelemetry-api
14
+ Requires-Dist: opentelemetry-exporter-otlp
15
+ Requires-Dist: opentelemetry-exporter-otlp-proto-common
16
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc
17
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http
18
+ Requires-Dist: opentelemetry-proto
19
+ Requires-Dist: opentelemetry-sdk
20
+ Requires-Dist: opentelemetry-semantic-conventions
21
+
22
+ # partial-span-processor
23
+ OTEL Python SDK extension supporting partial spans
24
+
25
+ ## build
26
+ `python -m build`
27
+
28
+ `pip install dist/partial_span_processor-0.0.x-py3-none-any.whl` to install locally
29
+
30
+ ## publishing
31
+ > requirement: `twine`
32
+
33
+ `python3 -m twine upload --repository pypi dist/* `
34
+
35
+ ## usage
36
+ ```python
37
+ import time
38
+
39
+ from opentelemetry import trace
40
+ from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import \
41
+ OTLPSpanExporter
42
+ from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
43
+ from opentelemetry.sdk._logs._internal.export import SimpleLogRecordProcessor
44
+ from opentelemetry.sdk.trace import TracerProvider
45
+ from partial_span_processor import PartialSpanProcessor
46
+
47
+ # Create a TracerProvider
48
+ provider = TracerProvider()
49
+
50
+ # Configure OTLP exporters
51
+ span_exporter = OTLPSpanExporter(endpoint="localhost:4317",
52
+ insecure=True) # grpc
53
+ log_exporter = OTLPLogExporter(endpoint="http://localhost:4318/v1/logs") # http
54
+
55
+ span_processor = PartialSpanProcessor(span_exporter,
56
+ SimpleLogRecordProcessor(log_exporter))
57
+ provider.add_span_processor(span_processor)
58
+
59
+ # Set the global TracerProvider
60
+ trace.set_tracer_provider(provider)
61
+ tracer = trace.get_tracer(__name__)
62
+
63
+ # Start a span (logs heartbeat and stop events)
64
+ with tracer.start_as_current_span("partial_span_1"):
65
+ print("partial_span_1 is running")
66
+ with tracer.start_as_current_span("partial_span_2"):
67
+ print("partial_span_2 is running")
68
+ with tracer.start_as_current_span("partial_span_3"):
69
+ print("partial_span_3 is running")
70
+ time.sleep(150)
71
+
72
+ provider.shutdown()
73
+ ```
74
+
75
+ ## usage config
76
+ * install python version 3.13.1
77
+ * create a working dir `test`
78
+ * create venv `python3 -m venv venv`
79
+ * copy above example script and name it `test.py`
80
+ * create `requirements.txt` with content
81
+ ```
82
+ opentelemetry-api
83
+ opentelemetry-sdk
84
+ opentelemetry-exporter-otlp
85
+ opentelemetry-instrumentation-logging
86
+ partial-span-processor
87
+ ```
88
+ * install requirements `pip install -r requirements.txt`
89
+ * run script `python test.py`
@@ -0,0 +1,68 @@
1
+ # partial-span-processor
2
+ OTEL Python SDK extension supporting partial spans
3
+
4
+ ## build
5
+ `python -m build`
6
+
7
+ `pip install dist/partial_span_processor-0.0.x-py3-none-any.whl` to install locally
8
+
9
+ ## publishing
10
+ > requirement: `twine`
11
+
12
+ `python3 -m twine upload --repository pypi dist/* `
13
+
14
+ ## usage
15
+ ```python
16
+ import time
17
+
18
+ from opentelemetry import trace
19
+ from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import \
20
+ OTLPSpanExporter
21
+ from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
22
+ from opentelemetry.sdk._logs._internal.export import SimpleLogRecordProcessor
23
+ from opentelemetry.sdk.trace import TracerProvider
24
+ from partial_span_processor import PartialSpanProcessor
25
+
26
+ # Create a TracerProvider
27
+ provider = TracerProvider()
28
+
29
+ # Configure OTLP exporters
30
+ span_exporter = OTLPSpanExporter(endpoint="localhost:4317",
31
+ insecure=True) # grpc
32
+ log_exporter = OTLPLogExporter(endpoint="http://localhost:4318/v1/logs") # http
33
+
34
+ span_processor = PartialSpanProcessor(span_exporter,
35
+ SimpleLogRecordProcessor(log_exporter))
36
+ provider.add_span_processor(span_processor)
37
+
38
+ # Set the global TracerProvider
39
+ trace.set_tracer_provider(provider)
40
+ tracer = trace.get_tracer(__name__)
41
+
42
+ # Start a span (logs heartbeat and stop events)
43
+ with tracer.start_as_current_span("partial_span_1"):
44
+ print("partial_span_1 is running")
45
+ with tracer.start_as_current_span("partial_span_2"):
46
+ print("partial_span_2 is running")
47
+ with tracer.start_as_current_span("partial_span_3"):
48
+ print("partial_span_3 is running")
49
+ time.sleep(150)
50
+
51
+ provider.shutdown()
52
+ ```
53
+
54
+ ## usage config
55
+ * install python version 3.13.1
56
+ * create a working dir `test`
57
+ * create venv `python3 -m venv venv`
58
+ * copy above example script and name it `test.py`
59
+ * create `requirements.txt` with content
60
+ ```
61
+ opentelemetry-api
62
+ opentelemetry-sdk
63
+ opentelemetry-exporter-otlp
64
+ opentelemetry-instrumentation-logging
65
+ partial-span-processor
66
+ ```
67
+ * install requirements `pip install -r requirements.txt`
68
+ * run script `python test.py`
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "partial-span-processor"
7
- version = "0.0.1"
7
+ version = "0.0.2"
8
8
  authors = [
9
9
  { name = "Mladjan Gadzic", email = "gadzic.mladjan@gmail.com" }
10
10
  ]
@@ -1,3 +1,17 @@
1
+ # Copyright The OpenTelemetry Authors
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ import base64
1
15
  import collections
2
16
  import logging
3
17
  import os
@@ -464,7 +478,7 @@ def get_logdata(span, attributes):
464
478
  trace_flags=TraceFlags().get_default(),
465
479
  severity_text="INFO",
466
480
  severity_number=SeverityNumber.INFO,
467
- body=bytes(serialized_traces_data),
481
+ body=base64.b64encode(serialized_traces_data).decode('utf-8'),
468
482
  attributes=attributes,
469
483
  )
470
484
  log_data = LogData(
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.2
2
+ Name: partial-span-processor
3
+ Version: 0.0.2
4
+ Summary: OTEL Python SDK extension supporting partial spans
5
+ Author-email: Mladjan Gadzic <gadzic.mladjan@gmail.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/mladjan-gadzic/partial-span-processor
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.13
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: opentelemetry-api
14
+ Requires-Dist: opentelemetry-exporter-otlp
15
+ Requires-Dist: opentelemetry-exporter-otlp-proto-common
16
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc
17
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http
18
+ Requires-Dist: opentelemetry-proto
19
+ Requires-Dist: opentelemetry-sdk
20
+ Requires-Dist: opentelemetry-semantic-conventions
21
+
22
+ # partial-span-processor
23
+ OTEL Python SDK extension supporting partial spans
24
+
25
+ ## build
26
+ `python -m build`
27
+
28
+ `pip install dist/partial_span_processor-0.0.x-py3-none-any.whl` to install locally
29
+
30
+ ## publishing
31
+ > requirement: `twine`
32
+
33
+ `python3 -m twine upload --repository pypi dist/* `
34
+
35
+ ## usage
36
+ ```python
37
+ import time
38
+
39
+ from opentelemetry import trace
40
+ from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import \
41
+ OTLPSpanExporter
42
+ from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
43
+ from opentelemetry.sdk._logs._internal.export import SimpleLogRecordProcessor
44
+ from opentelemetry.sdk.trace import TracerProvider
45
+ from partial_span_processor import PartialSpanProcessor
46
+
47
+ # Create a TracerProvider
48
+ provider = TracerProvider()
49
+
50
+ # Configure OTLP exporters
51
+ span_exporter = OTLPSpanExporter(endpoint="localhost:4317",
52
+ insecure=True) # grpc
53
+ log_exporter = OTLPLogExporter(endpoint="http://localhost:4318/v1/logs") # http
54
+
55
+ span_processor = PartialSpanProcessor(span_exporter,
56
+ SimpleLogRecordProcessor(log_exporter))
57
+ provider.add_span_processor(span_processor)
58
+
59
+ # Set the global TracerProvider
60
+ trace.set_tracer_provider(provider)
61
+ tracer = trace.get_tracer(__name__)
62
+
63
+ # Start a span (logs heartbeat and stop events)
64
+ with tracer.start_as_current_span("partial_span_1"):
65
+ print("partial_span_1 is running")
66
+ with tracer.start_as_current_span("partial_span_2"):
67
+ print("partial_span_2 is running")
68
+ with tracer.start_as_current_span("partial_span_3"):
69
+ print("partial_span_3 is running")
70
+ time.sleep(150)
71
+
72
+ provider.shutdown()
73
+ ```
74
+
75
+ ## usage config
76
+ * install python version 3.13.1
77
+ * create a working dir `test`
78
+ * create venv `python3 -m venv venv`
79
+ * copy above example script and name it `test.py`
80
+ * create `requirements.txt` with content
81
+ ```
82
+ opentelemetry-api
83
+ opentelemetry-sdk
84
+ opentelemetry-exporter-otlp
85
+ opentelemetry-instrumentation-logging
86
+ partial-span-processor
87
+ ```
88
+ * install requirements `pip install -r requirements.txt`
89
+ * run script `python test.py`
@@ -1,23 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: partial-span-processor
3
- Version: 0.0.1
4
- Summary: OTEL Python SDK extension supporting partial spans
5
- Author-email: Mladjan Gadzic <gadzic.mladjan@gmail.com>
6
- License: Apache-2.0
7
- Project-URL: Homepage, https://github.com/mladjan-gadzic/partial-span-processor
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.13
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
- Requires-Dist: opentelemetry-api
14
- Requires-Dist: opentelemetry-exporter-otlp
15
- Requires-Dist: opentelemetry-exporter-otlp-proto-common
16
- Requires-Dist: opentelemetry-exporter-otlp-proto-grpc
17
- Requires-Dist: opentelemetry-exporter-otlp-proto-http
18
- Requires-Dist: opentelemetry-proto
19
- Requires-Dist: opentelemetry-sdk
20
- Requires-Dist: opentelemetry-semantic-conventions
21
-
22
- # partial-span-processor
23
- OTEL Python SDK extension supporting partial spans
@@ -1,2 +0,0 @@
1
- # partial-span-processor
2
- OTEL Python SDK extension supporting partial spans
@@ -1,23 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: partial-span-processor
3
- Version: 0.0.1
4
- Summary: OTEL Python SDK extension supporting partial spans
5
- Author-email: Mladjan Gadzic <gadzic.mladjan@gmail.com>
6
- License: Apache-2.0
7
- Project-URL: Homepage, https://github.com/mladjan-gadzic/partial-span-processor
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.13
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
- Requires-Dist: opentelemetry-api
14
- Requires-Dist: opentelemetry-exporter-otlp
15
- Requires-Dist: opentelemetry-exporter-otlp-proto-common
16
- Requires-Dist: opentelemetry-exporter-otlp-proto-grpc
17
- Requires-Dist: opentelemetry-exporter-otlp-proto-http
18
- Requires-Dist: opentelemetry-proto
19
- Requires-Dist: opentelemetry-sdk
20
- Requires-Dist: opentelemetry-semantic-conventions
21
-
22
- # partial-span-processor
23
- OTEL Python SDK extension supporting partial spans