rebrandly-otel 0.2.5__tar.gz → 0.2.6__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.
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/PKG-INFO +37 -1
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/README.md +36 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/rebrandly_otel.egg-info/PKG-INFO +37 -1
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/rebrandly_otel.egg-info/SOURCES.txt +5 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/setup.py +1 -1
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/src/fastapi_support.py +1 -1
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/src/flask_support.py +1 -1
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/src/http_utils.py +2 -1
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/src/rebrandly_otel.py +8 -2
- rebrandly_otel-0.2.6/tests/test_decorators.py +687 -0
- rebrandly_otel-0.2.6/tests/test_fastapi_support.py +179 -0
- rebrandly_otel-0.2.6/tests/test_flask_support.py +140 -0
- rebrandly_otel-0.2.6/tests/test_metrics_and_logs.py +598 -0
- rebrandly_otel-0.2.6/tests/test_pymysql_instrumentation.py +344 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/tests/test_usage.py +2 -17
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/LICENSE +0 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/rebrandly_otel.egg-info/dependency_links.txt +0 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/rebrandly_otel.egg-info/requires.txt +0 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/rebrandly_otel.egg-info/top_level.txt +0 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/setup.cfg +0 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/src/__init__.py +0 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/src/logs.py +0 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/src/metrics.py +0 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/src/otel_utils.py +0 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/src/pymysql_instrumentation.py +0 -0
- {rebrandly_otel-0.2.5 → rebrandly_otel-0.2.6}/src/traces.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rebrandly_otel
|
|
3
|
-
Version: 0.2.
|
|
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.
|
|
@@ -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.
|
|
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.
|
|
@@ -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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# fastapi_integration.py
|
|
2
2
|
"""FastAPI integration for Rebrandly OTEL SDK."""
|
|
3
3
|
import json
|
|
4
|
-
from
|
|
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
|
|
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
|
|
@@ -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
|
-
|
|
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
|