Pure C lib for python3 (or C if u wanna) to analyze traces check for compliance with the OpenTelemetry standard
Project description
Pure C lib for python3 (or C if u wanna) to analyze traces check for compliance with the OpenTelemetry standard.
Example:
from otelanalyzer import *
import json
def testTrace(a: Analyzer, t: str):
tr = Trace()
tr.traceString = t
tr.traceId = "1" * 32
tr.serviceName = "some-name"
a.analyze_btrace(tr)
r = a.get_counters('some-name')
print(json.dumps(r, indent=4))
if __name__ == '__main__':
t = "[{'spanId': '0000000000000000', 'serviceName': 'some-name', 'traceId': '00000000000000000000000000000000', 'project': 'some-project', 'service': 'some-service'}]"
a = Analyzer()
testTrace(a, t)
Result
$ python3 test_lib.py
{
"UndefTraceStatus": 0,
"myMissingParent": 0,
"notmyMissingParent": 0,
"myNoParentInTrace": 0,
"notmyNoParentInTrace": 0,
"myDublicateSpan": 0,
"notmyDublicateSpan": 0,
"myBadSpanIdSize": 0,
"notmyBadSpanIdSize": 0,
"myBadTraceIdSize": 0,
"notmyBadTraceIdSize": 0,
"myExamples": [],
"notmyExamples": [],
"badTraceCount": 0,
"mySpanCount": 1,
"traceCount": 1
}
$ valgrind --tool=memcheck --leak-check=full python3 test_lib.py
==374573== HEAP SUMMARY:
==374573== in use at exit: 397,058 bytes in 11 blocks
==374573== total heap usage: 3,462 allocs, 3,451 frees, 4,881,009 bytes allocated
==374573==
==374573== LEAK SUMMARY:
==374573== definitely lost: 0 bytes in 0 blocks
==374573== indirectly lost: 0 bytes in 0 blocks
==374573== possibly lost: 0 bytes in 0 blocks
==374573== still reachable: 397,058 bytes in 11 blocks
==374573== suppressed: 0 bytes in 0 blocks
Plugins
Plugins for this pacage can add some more robust trace analyzation and edgecase managin. They will be called after splitting trace into spans, so you can work more comfortable. Motivation for this feature is to be able to add NDA-protected features without forking project.
C plugins
You can add your C analyzation plugins in src/plugins.c file. they src files should be placed in src/plugins/ folder. plugin should have a function Analyzer*, Trace* params that has a void type. there is an example plugin in src/plugins/example_plugin.*
You are strongly encouraged to write your plugins with header files, as example_plugin.
Your function will be called after parsing trace into separate spans. please keep in mind, that trace.traceString will be freed at this point for optimization reasons.
Python plugins
not implemented yet, planned asap
installation
$ pip install otelanalyzer
or
$ python3 setup.py build_ext --inplace && mv ./otelanalyzer.so ./otelanalyzer
dependencies
Pacage has no dependencies
planed features
- python plugins support
- python unit tests
- wheels for python-13 (you already can build it locally, check installation)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file otelanalyzer-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: otelanalyzer-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 72.1 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e84ba6852801c4bb79f54dc329a54d53c3136da783b22539617fbfba4601f93d
|
|
| MD5 |
0d565affc9184df64c512bce06cf0946
|
|
| BLAKE2b-256 |
ebeca383c427d8dc452461cf80bb596127729b0a3d540834601fd95475844359
|
File details
Details for the file otelanalyzer-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: otelanalyzer-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 70.4 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e6a105d6a298c3952281e798f183d9a030521aca6d58d3b8bf33069c6bc3e0d
|
|
| MD5 |
307932e3b965d3876dec689ea4dc09f3
|
|
| BLAKE2b-256 |
1d1c466b765dd3448b3a11cb66173b351d17e86615897c8f002d3f1cf7efcc93
|
File details
Details for the file otelanalyzer-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: otelanalyzer-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 68.9 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9101d4f968acc68be0ff15d9a2befd7231b569379fd1aee2bc4dc0a730fbf4c2
|
|
| MD5 |
3fecd71f62593b720b62de075ecf6371
|
|
| BLAKE2b-256 |
8466137e5c9068cc9e1da6446a8ce1fbda69d42c65ec16afae50f9d2d069c10e
|