rebrandly-otel 0.2.5__tar.gz → 0.2.8__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.

Potentially problematic release.


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

Files changed (26) hide show
  1. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/PKG-INFO +37 -1
  2. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/README.md +36 -0
  3. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/rebrandly_otel.egg-info/PKG-INFO +37 -1
  4. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/rebrandly_otel.egg-info/SOURCES.txt +5 -0
  5. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/setup.py +1 -1
  6. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/src/fastapi_support.py +1 -1
  7. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/src/flask_support.py +1 -1
  8. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/src/http_utils.py +2 -1
  9. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/src/otel_utils.py +3 -1
  10. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/src/rebrandly_otel.py +8 -2
  11. rebrandly_otel-0.2.8/tests/test_decorators.py +687 -0
  12. rebrandly_otel-0.2.8/tests/test_fastapi_support.py +179 -0
  13. rebrandly_otel-0.2.8/tests/test_flask_support.py +140 -0
  14. rebrandly_otel-0.2.8/tests/test_metrics_and_logs.py +598 -0
  15. rebrandly_otel-0.2.8/tests/test_pymysql_instrumentation.py +344 -0
  16. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/tests/test_usage.py +2 -17
  17. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/LICENSE +0 -0
  18. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/rebrandly_otel.egg-info/dependency_links.txt +0 -0
  19. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/rebrandly_otel.egg-info/requires.txt +0 -0
  20. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/rebrandly_otel.egg-info/top_level.txt +0 -0
  21. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/setup.cfg +0 -0
  22. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/src/__init__.py +0 -0
  23. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/src/logs.py +0 -0
  24. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/src/metrics.py +0 -0
  25. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/src/pymysql_instrumentation.py +0 -0
  26. {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.8}/src/traces.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rebrandly_otel
3
- Version: 0.2.5
3
+ Version: 0.2.8
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.
@@ -475,6 +475,42 @@ Environment configuration:
475
475
  ### More examples
476
476
  You can find More examples [here](examples)
477
477
 
478
+ ## Testing
479
+
480
+ ### Running Tests
481
+
482
+ The test suite uses [pytest](https://docs.pytest.org/).
483
+
484
+ Run all tests:
485
+ ```bash
486
+ pytest
487
+ ```
488
+
489
+ Run specific test file:
490
+ ```bash
491
+ pytest tests/test_flask_support.py -v
492
+ pytest tests/test_fastapi_support.py -v
493
+ pytest tests/test_usage.py -v
494
+ pytest tests/test_pymysql_instrumentation.py -v
495
+ pytest tests/test_metrics_and_logs.py -v
496
+ pytest tests/test_decorators.py -v
497
+ ```
498
+
499
+ Run with coverage:
500
+ ```bash
501
+ pytest --cov=src --cov-report=html
502
+ ```
503
+
504
+ ### Test Coverage
505
+
506
+ The test suite includes:
507
+ - **Integration tests** (`test_usage.py`): Core OTEL functionality, Lambda handlers, message processing
508
+ - **Flask integration tests** (`test_flask_support.py`): Flask setup and hooks
509
+ - **FastAPI integration tests** (`test_fastapi_support.py`): FastAPI setup and middleware
510
+ - **PyMySQL instrumentation tests** (`test_pymysql_instrumentation.py`): Database connection instrumentation, query tracing, helper functions
511
+ - **Metrics and logs tests** (`test_metrics_and_logs.py`): Custom metrics creation (counter, histogram, gauge), logging levels (info, warning, debug, error)
512
+ - **Decorators tests** (`test_decorators.py`): Lambda handler decorator, AWS message handler decorator, traces decorator, aws_message_span context manager
513
+
478
514
  ## License
479
515
 
480
516
  Rebrandly Python SDK is released under the MIT License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rebrandly_otel
3
- Version: 0.2.5
3
+ Version: 0.2.8
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.
@@ -16,4 +16,9 @@ src/otel_utils.py
16
16
  src/pymysql_instrumentation.py
17
17
  src/rebrandly_otel.py
18
18
  src/traces.py
19
+ tests/test_decorators.py
20
+ tests/test_fastapi_support.py
21
+ tests/test_flask_support.py
22
+ tests/test_metrics_and_logs.py
23
+ tests/test_pymysql_instrumentation.py
19
24
  tests/test_usage.py
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="rebrandly_otel",
8
- version="0.2.5",
8
+ version="0.2.8",
9
9
  author="Antonio Romano",
10
10
  author_email="antonio@rebrandly.com",
11
11
  description="Python OTEL wrapper by Rebrandly",
@@ -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 = {}
@@ -29,7 +29,9 @@ def create_resource(name: str = None, version: str = None) -> Resource:
29
29
  process_attributes.PROCESS_RUNTIME_VERSION: f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
30
30
  SERVICE_NAMESPACE: env,
31
31
  DEPLOYMENT_ENVIRONMENT: env,
32
- telemetry_attributes.TELEMETRY_SDK_LANGUAGE: "python"
32
+ telemetry_attributes.TELEMETRY_SDK_LANGUAGE: "python",
33
+ telemetry_attributes.TELEMETRY_SDK_NAME: "rebrandly-otel-sdk",
34
+ telemetry_attributes.TELEMETRY_SDK_VERSION: version
33
35
  }
34
36
 
35
37
  if os.environ.get('OTEL_RESOURCE_ATTRIBUTES', None) is not None and os.environ.get('OTEL_RESOURCE_ATTRIBUTES', None).strip() != "":
@@ -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