rebrandly-otel 0.2.4__tar.gz → 0.2.5__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.4 → rebrandly_otel-0.2.5}/PKG-INFO +1 -1
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/rebrandly_otel.egg-info/PKG-INFO +1 -1
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/setup.py +1 -1
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/src/otel_utils.py +12 -2
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/LICENSE +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/README.md +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/rebrandly_otel.egg-info/SOURCES.txt +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/rebrandly_otel.egg-info/dependency_links.txt +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/rebrandly_otel.egg-info/requires.txt +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/rebrandly_otel.egg-info/top_level.txt +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/setup.cfg +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/src/__init__.py +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/src/fastapi_support.py +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/src/flask_support.py +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/src/http_utils.py +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/src/logs.py +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/src/metrics.py +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/src/pymysql_instrumentation.py +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/src/rebrandly_otel.py +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/src/traces.py +0 -0
- {rebrandly_otel-0.2.4 → rebrandly_otel-0.2.5}/tests/test_usage.py +0 -0
|
@@ -6,7 +6,7 @@ import sys
|
|
|
6
6
|
import grpc
|
|
7
7
|
import json
|
|
8
8
|
|
|
9
|
-
from opentelemetry.sdk.resources import Resource, SERVICE_NAMESPACE
|
|
9
|
+
from opentelemetry.sdk.resources import Resource, SERVICE_NAMESPACE, DEPLOYMENT_ENVIRONMENT
|
|
10
10
|
from opentelemetry.semconv.attributes import service_attributes, telemetry_attributes
|
|
11
11
|
from opentelemetry.semconv.resource import ResourceAttributes
|
|
12
12
|
from opentelemetry.semconv._incubating.attributes import process_attributes, deployment_attributes
|
|
@@ -21,11 +21,14 @@ def create_resource(name: str = None, version: str = None) -> Resource:
|
|
|
21
21
|
if version is None:
|
|
22
22
|
version = get_service_version()
|
|
23
23
|
|
|
24
|
+
env = os.environ.get('ENV', os.environ.get('ENVIRONMENT', os.environ.get('NODE_ENV', 'local')))
|
|
25
|
+
|
|
24
26
|
resources_attributes = {
|
|
25
27
|
service_attributes.SERVICE_NAME: name,
|
|
26
28
|
service_attributes.SERVICE_VERSION: version,
|
|
27
29
|
process_attributes.PROCESS_RUNTIME_VERSION: f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
|
|
28
|
-
SERVICE_NAMESPACE:
|
|
30
|
+
SERVICE_NAMESPACE: env,
|
|
31
|
+
DEPLOYMENT_ENVIRONMENT: env,
|
|
29
32
|
telemetry_attributes.TELEMETRY_SDK_LANGUAGE: "python"
|
|
30
33
|
}
|
|
31
34
|
|
|
@@ -41,6 +44,13 @@ def create_resource(name: str = None, version: str = None) -> Resource:
|
|
|
41
44
|
resources_attributes[k.strip()] = v.strip()
|
|
42
45
|
except Exception as e:
|
|
43
46
|
print(f"[OTEL Utils] Warning: Invalid OTEL_RESOURCE_ATTRIBUTES value: {e}")
|
|
47
|
+
|
|
48
|
+
if os.environ.get('OTEL_REPO_NAME', None) is not None:
|
|
49
|
+
resources_attributes['repository.name'] = os.environ.get('OTEL_REPO_NAME')
|
|
50
|
+
|
|
51
|
+
if os.environ.get('OTEL_COMMIT_ID', None) is not None:
|
|
52
|
+
resources_attributes[service_attributes.SERVICE_VERSION] = os.environ.get('OTEL_COMMIT_ID')
|
|
53
|
+
|
|
44
54
|
resource = Resource.create(
|
|
45
55
|
resources_attributes
|
|
46
56
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|