rebrandly-otel 0.2.5__py3-none-any.whl → 0.2.6__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.

Potentially problematic release.


This version of rebrandly-otel might be problematic. Click here for more details.

@@ -1,7 +1,7 @@
1
1
  # fastapi_integration.py
2
2
  """FastAPI integration for Rebrandly OTEL SDK."""
3
3
  import json
4
- from rebrandly_otel import Status, StatusCode, SpanKind
4
+ from opentelemetry.trace import Status, StatusCode, SpanKind
5
5
  from .http_utils import filter_important_headers
6
6
  from fastapi import HTTPException, Depends
7
7
  from starlette.requests import Request
@@ -2,7 +2,7 @@
2
2
  """Flask integration for Rebrandly OTEL SDK."""
3
3
 
4
4
  import json
5
- from rebrandly_otel import Status, StatusCode, SpanKind
5
+ from opentelemetry.trace import Status, StatusCode, SpanKind
6
6
  from .http_utils import filter_important_headers
7
7
 
8
8
  from flask import request, jsonify
@@ -18,7 +18,8 @@ def filter_important_headers(headers):
18
18
  'x-forwarded-proto',
19
19
  'x-request-id',
20
20
  'x-correlation-id',
21
- 'x-trace-id'
21
+ 'x-trace-id',
22
+ 'user-agent'
22
23
  ]
23
24
 
24
25
  filtered = {}
@@ -73,7 +73,7 @@ class RebrandlyOTEL:
73
73
  kind: SpanKind = SpanKind.INTERNAL,
74
74
  message=None):
75
75
  """Create a span using context manager."""
76
- with self.tracer.start_span(name, attributes=attributes, kind=kind) as span:
76
+ with self.tracer.start_span(name=name, attributes=attributes, kind=kind) as span:
77
77
  try:
78
78
  yield span
79
79
  span.set_status(Status(StatusCode.OK))
@@ -510,7 +510,13 @@ class RebrandlyOTEL:
510
510
  attributes=combined_attributes,
511
511
  kind=kind
512
512
  ) as span:
513
- yield span
513
+ try:
514
+ yield span
515
+ span.set_status(Status(StatusCode.OK))
516
+ except Exception as e:
517
+ span.record_exception(e)
518
+ span.set_status(Status(StatusCode.ERROR, str(e)))
519
+ raise
514
520
 
515
521
 
516
522
  # Create Singleton instance
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rebrandly_otel
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: Python OTEL wrapper by Rebrandly
5
5
  Home-page: https://github.com/rebrandly/rebrandly-otel-python
6
6
  Author: Antonio Romano
@@ -502,6 +502,42 @@ Environment configuration:
502
502
  ### More examples
503
503
  You can find More examples [here](examples)
504
504
 
505
+ ## Testing
506
+
507
+ ### Running Tests
508
+
509
+ The test suite uses [pytest](https://docs.pytest.org/).
510
+
511
+ Run all tests:
512
+ ```bash
513
+ pytest
514
+ ```
515
+
516
+ Run specific test file:
517
+ ```bash
518
+ pytest tests/test_flask_support.py -v
519
+ pytest tests/test_fastapi_support.py -v
520
+ pytest tests/test_usage.py -v
521
+ pytest tests/test_pymysql_instrumentation.py -v
522
+ pytest tests/test_metrics_and_logs.py -v
523
+ pytest tests/test_decorators.py -v
524
+ ```
525
+
526
+ Run with coverage:
527
+ ```bash
528
+ pytest --cov=src --cov-report=html
529
+ ```
530
+
531
+ ### Test Coverage
532
+
533
+ The test suite includes:
534
+ - **Integration tests** (`test_usage.py`): Core OTEL functionality, Lambda handlers, message processing
535
+ - **Flask integration tests** (`test_flask_support.py`): Flask setup and hooks
536
+ - **FastAPI integration tests** (`test_fastapi_support.py`): FastAPI setup and middleware
537
+ - **PyMySQL instrumentation tests** (`test_pymysql_instrumentation.py`): Database connection instrumentation, query tracing, helper functions
538
+ - **Metrics and logs tests** (`test_metrics_and_logs.py`): Custom metrics creation (counter, histogram, gauge), logging levels (info, warning, debug, error)
539
+ - **Decorators tests** (`test_decorators.py`): Lambda handler decorator, AWS message handler decorator, traces decorator, aws_message_span context manager
540
+
505
541
  ## License
506
542
 
507
543
  Rebrandly Python SDK is released under the MIT License.
@@ -0,0 +1,15 @@
1
+ rebrandly_otel/__init__.py,sha256=dEcTvHbhNNp0XD_7jojxeHXNa1QDCI9HxayeICaK_WY,491
2
+ rebrandly_otel/fastapi_support.py,sha256=M1FHkM9Uv6pga6s8F3O-IeXAXzc4EMPAXAStRk7bGu4,8222
3
+ rebrandly_otel/flask_support.py,sha256=wn_Esiu4cy48f_rD-kwIypRKeJ8D1pT6x4WZacEQmZY,6321
4
+ rebrandly_otel/http_utils.py,sha256=5mHJQCJ-5FDFNmTRPaErtdQLAEzCbcDJqoiGzjgKe0w,741
5
+ rebrandly_otel/logs.py,sha256=9uwWbQ9h9YcxF7-2vtsYucaMGCqMoPnO2vWf6qkyGgI,5328
6
+ rebrandly_otel/metrics.py,sha256=jZPygTY7vie33sadXc7P1DwLTKe9tJvAWSZuGHW1xQg,7743
7
+ rebrandly_otel/otel_utils.py,sha256=vr5ygRXY2If-c2Vq2ectupTm1AHgSPkflEw25O5T7NE,6162
8
+ rebrandly_otel/pymysql_instrumentation.py,sha256=lS_V5DcsnpQ3f2PoNqeM7t3Jyiew2KNURM9iILfz8sM,6477
9
+ rebrandly_otel/rebrandly_otel.py,sha256=dnE8jkcnP3X7Eu_tpjWU96pYJ5dULV-QVK_Im_msdEM,22675
10
+ rebrandly_otel/traces.py,sha256=JY_3RWbzpUxzEx3GqTVgggsyA2DB4oR-zDftIFFJha4,7174
11
+ rebrandly_otel-0.2.6.dist-info/licenses/LICENSE,sha256=KMXHvTwP62S2q-SG7CFfMU_09rUwxiqlM0izaYGdcgY,1103
12
+ rebrandly_otel-0.2.6.dist-info/METADATA,sha256=rzUepZJY4gckBpN6NIIrMajNwIQITBvEH-h6bSjaKM0,15740
13
+ rebrandly_otel-0.2.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ rebrandly_otel-0.2.6.dist-info/top_level.txt,sha256=26PSC1gjVUl8tTH5QfKbFevjVV4E2yojoukEfiTScvM,15
15
+ rebrandly_otel-0.2.6.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- rebrandly_otel/__init__.py,sha256=dEcTvHbhNNp0XD_7jojxeHXNa1QDCI9HxayeICaK_WY,491
2
- rebrandly_otel/fastapi_support.py,sha256=Fq0ggBvmz4nSGBw8p9PGIGcTcpwlbmt5BgLLbl1bf6s,8217
3
- rebrandly_otel/flask_support.py,sha256=G0Q3apg4urtvHfXFb1uANomryAL7Mo2nPPULEe7j7WQ,6316
4
- rebrandly_otel/http_utils.py,sha256=Cwo1Ku1-BMqRp37ycvHtbiArxEjFPYU_zkF1H9_7CIE,719
5
- rebrandly_otel/logs.py,sha256=9uwWbQ9h9YcxF7-2vtsYucaMGCqMoPnO2vWf6qkyGgI,5328
6
- rebrandly_otel/metrics.py,sha256=jZPygTY7vie33sadXc7P1DwLTKe9tJvAWSZuGHW1xQg,7743
7
- rebrandly_otel/otel_utils.py,sha256=vr5ygRXY2If-c2Vq2ectupTm1AHgSPkflEw25O5T7NE,6162
8
- rebrandly_otel/pymysql_instrumentation.py,sha256=lS_V5DcsnpQ3f2PoNqeM7t3Jyiew2KNURM9iILfz8sM,6477
9
- rebrandly_otel/rebrandly_otel.py,sha256=8ty2rxcuaYV5WsNye7odxXXuh91kpdd5RVGOGSvsT98,22430
10
- rebrandly_otel/traces.py,sha256=JY_3RWbzpUxzEx3GqTVgggsyA2DB4oR-zDftIFFJha4,7174
11
- rebrandly_otel-0.2.5.dist-info/licenses/LICENSE,sha256=KMXHvTwP62S2q-SG7CFfMU_09rUwxiqlM0izaYGdcgY,1103
12
- rebrandly_otel-0.2.5.dist-info/METADATA,sha256=-kU1ruj2BNZA2yJ8vYouX1wiuxfzyFJWri69bThqJeI,14509
13
- rebrandly_otel-0.2.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
- rebrandly_otel-0.2.5.dist-info/top_level.txt,sha256=26PSC1gjVUl8tTH5QfKbFevjVV4E2yojoukEfiTScvM,15
15
- rebrandly_otel-0.2.5.dist-info/RECORD,,