gl-observability-binary 0.1.0__cp312-cp312-win_amd64.whl → 0.1.1__cp312-cp312-win_amd64.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.
@@ -18,13 +18,13 @@ class OpenTelemetryBackendConfig:
18
18
  **kwargs: Additional keyword arguments passed to OTLPSpanExporter.
19
19
  '''
20
20
 
21
- def init_otel_with_external_exporter(tracer_provider: TracerProvider, config: OpenTelemetryBackendConfig) -> None:
21
+ def init_otel_with_external_exporter(config: OpenTelemetryBackendConfig, tracer_provider: TracerProvider) -> None:
22
22
  """Initialize OpenTelemetry with an external OTLP exporter.
23
23
 
24
24
  This method initializes OpenTelemetry with an external exporter (OTLP)
25
25
  and instruments FastAPI, Langchain, HTTPX, and Requests if configured.
26
26
 
27
27
  Args:
28
- tracer_provider (TracerProvider): The tracer provider to use.
29
28
  config (OpenTelemetryBackendConfig): The OTLP exporter configuration.
29
+ tracer_provider (TracerProvider): The tracer provider to use.
30
30
  """
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gl-observability-binary
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: SDK for Observability tools
5
5
  Author-email: HansSeanNathanael <hans.s.nathanael@gdplabs.id>
6
6
  Requires-Python: <3.14,>=3.11
@@ -34,7 +34,7 @@ Requires-Dist: ruff<1.0.0,>=0.11.12; extra == "dev"
34
34
 
35
35
  ## Key Features
36
36
 
37
- - 📊 **OpenTelemetry Integration**: simplified initialization for tracing and metrics.
37
+ - 📊 **OpenTelemetry Integration**: simplified initialization for tracing.
38
38
  - 🛡️ **Sentry Support**: easy setup for error tracking and performance monitoring.
39
39
  - 🕵️ **PII Redaction**: custom logging handlers to redact PII using Regex or NER (Named Entity Recognition).
40
40
  - 🔌 **Framework Support**: built-in support for FastAPI, Langchain, HTTPX, and Requests instrumentation.
@@ -84,34 +84,39 @@ poetry add "git+ssh://git@github.com/GDP-ADMIN/gl-sdk.git#subdirectory=libs/gl-o
84
84
 
85
85
  ### 1. Telemetry Initialization
86
86
 
87
- The library uses a unified `init_telemetry` function that takes a `TelemetryConfig` object. You can configure it for OpenTelemetry, Sentry, or both.
87
+ The library uses a unified `init_telemetry` function that takes a `TelemetryConfig` object. You can configure it to send traces to OpenTelemetry (OTLP) or Sentry backend. Multiple backend configuration is supported.
88
88
 
89
- #### OpenTelemetry Configuration (External Exporter)
89
+ #### OpenTelemetry Configuration
90
90
 
91
91
  This setup sends traces to an external OTLP collector (e.g., Jaeger, Tempo).
92
92
 
93
93
  ```python
94
94
  from fastapi import FastAPI
95
- from gl_observability.traces.opentelemetry import FastAPIConfig, OpenTelemetryConfig
96
- from gl_observability import TelemetryConfig, init_telemetry
95
+ from gl_observability import init_telemetry, TelemetryConfig, OpenTelemetryBackendConfig, FastAPIConfig
97
96
 
98
97
  # 1. Setup FastAPI Config (optional, if using FastAPI)
99
98
  app = FastAPI()
100
99
  fastapi_config = FastAPIConfig(app=app)
101
100
 
102
- # 2. Configure OpenTelemetry
103
- otel_config = OpenTelemetryConfig(
104
- endpoint="localhost:4317", # OTLP endpoint
105
- use_grpc=False, # Use gRPC or HTTP
106
- fastapi_config=fastapi_config,
107
- use_langchain=True, # Enable Langchain instrumentation
108
- use_httpx=True, # Enable HTTPX instrumentation
109
- use_requests=True, # Enable Requests instrumentation
110
- attributes={"service.name": "my-service", "env": "production"}
101
+ # 2. Configure OpenTelemetryBackendConfig
102
+ otel_backend_config = OpenTelemetryBackendConfig(
103
+ endpoint="localhost:4318", # OTLP endpoint
104
+ use_grpc=False, # Use gRPC or HTTP
105
+ headers={"Authorization": "Bearer ..."}, # Optional headers
111
106
  )
112
107
 
113
- # 3. Initialize Telemetry
114
- init_telemetry(TelemetryConfig(otel_config=otel_config))
108
+ # 3. Configure TelemetryConfig
109
+ otel_config = TelemetryConfig(
110
+ attributes={"service.name": "..."}, # Resource attributes
111
+ backend_config=otel_backend_config, # Backend configuration
112
+ fastapi_config=fastapi_config, # FastAPI Instrumentation
113
+ use_langchain=True, # Enable Langchain instrumentation
114
+ use_httpx=True, # Enable HTTPX instrumentation
115
+ use_requests=True, # Enable Requests instrumentation
116
+ )
117
+
118
+ # 4. Initialize Telemetry
119
+ init_telemetry(otel_config)
115
120
  ```
116
121
 
117
122
  #### Sentry Configuration
@@ -119,55 +124,69 @@ init_telemetry(TelemetryConfig(otel_config=otel_config))
119
124
  This setup sends errors and traces to Sentry.
120
125
 
121
126
  ```python
122
- from gl_observability.traces.sentry import SentryConfig
123
- from gl_observability import TelemetryConfig, init_telemetry
124
-
125
- def traces_sampler(sampling_context: dict) -> float:
126
- """Custom trace sampler."""
127
- return 1.0
128
-
129
- # 1. Configure Sentry
130
- sentry_config = SentryConfig(
131
- dsn="your-sentry-dsn",
132
- environment="production",
133
- release="1.0.0",
134
- traces_sampler=traces_sampler,
135
- send_default_pii=True
127
+ from fastapi import FastAPI
128
+ from gl_observability import init_telemetry, TelemetryConfig, SentryBackendConfig, FastAPIConfig
129
+
130
+ # 1. Setup FastAPI Config (optional, if using FastAPI)
131
+ app = FastAPI()
132
+ fastapi_config = FastAPIConfig(app=app)
133
+
134
+ # 2. Configure SentryBackendConfig
135
+ sentry_backend_config = SentryBackendConfig(
136
+ dsn="https://...",
137
+ environment="...",
138
+ release="...",
139
+ send_default_pii=True,
140
+ disable_sentry_distributed_tracing=False
136
141
  )
137
142
 
138
- # 2. Initialize Telemetry
139
- init_telemetry(TelemetryConfig(sentry_config=sentry_config))
143
+ # 3. Configure TelemetryConfig
144
+ otel_config = TelemetryConfig(
145
+ attributes={"service.name": "..."}, # Resource attributes
146
+ backend_config=sentry_backend_config, # Backend configuration
147
+ fastapi_config=fastapi_config, # FastAPI Instrumentation
148
+ use_langchain=True, # Enable Langchain instrumentation
149
+ use_httpx=True, # Enable HTTPX instrumentation
150
+ use_requests=True, # Enable Requests instrumentation
151
+ )
152
+
153
+ # 4. Initialize Telemetry
154
+ init_telemetry(otel_config)
140
155
  ```
141
156
 
142
- #### Sentry with OpenTelemetry
157
+ #### Multiple Backend Configuration
143
158
 
144
- This setup combines Sentry with OpenTelemetry instrumentation, allowing Sentry to capture OTel spans.
159
+ This setup the OpenTelemetry SDK used for tracing.
145
160
 
146
161
  ```python
147
162
  from fastapi import FastAPI
148
- from gl_observability.traces.opentelemetry import FastAPIConfig, OpenTelemetryConfig
149
- from gl_observability.traces.sentry import SentryConfig
150
- from gl_observability import TelemetryConfig, init_telemetry
151
-
152
- app = FastAPI()
153
- fastapi_config = FastAPIConfig(app=app)
154
-
155
- # 1. Configure OpenTelemetry (without endpoint, as Sentry handles export)
156
- otel_config = OpenTelemetryConfig(
157
- attributes={"service.name": "my-service"},
158
- fastapi_config=fastapi_config,
159
- use_langchain=True
163
+ from gl_observability import init_telemetry, TelemetryConfig, OpenTelemetryBackendConfig, SentryBackendConfig
164
+
165
+ jaeger_backend = OpenTelemetryBackendConfig(endpoint="jager...", ...)
166
+ init_telemetry(
167
+ TelemetryConfig(
168
+ attributes={"service.name": "..."},
169
+ backend_config=jaeger_backend,
170
+ fastapi_config=fastapi_config,
171
+ use_langchain=True,
172
+ use_httpx=True,
173
+ use_requests=True,
174
+ )
160
175
  )
161
176
 
162
- # 2. Configure Sentry with OTel config
163
- sentry_config = SentryConfig(
164
- dsn="your-sentry-dsn",
165
- environment="production",
166
- open_telemetry_config=otel_config
177
+ langfuse_backend = OpenTelemetryBackendConfig(endpoint="langfuse...", ...)
178
+ init_telemetry(
179
+ TelemetryConfig(
180
+ backend_config=langfuse_backend
181
+ )
167
182
  )
168
183
 
169
- # 3. Initialize Telemetry
170
- init_telemetry(TelemetryConfig(sentry_config=sentry_config))
184
+ sentry_backend = SentryBackendConfig(dsn="https://...", ...)
185
+ init_telemetry(
186
+ TelemetryConfig(
187
+ backend_config=sentry_backend
188
+ )
189
+ )
171
190
  ```
172
191
 
173
192
  ### 2. Logging Handlers
@@ -1,4 +1,4 @@
1
- gl_observability.cp312-win_amd64.pyd,sha256=f9aApaLgH2KzPHB2LHevOKo0aGrwak3Yz1WtGvg73So,649728
1
+ gl_observability.cp312-win_amd64.pyd,sha256=QWLdX_t-OGG7CW9bFyZuuTZViFXjlyshnHudLW_Xz8E,649728
2
2
  gl_observability.pyi,sha256=zLWMUAsSLQclPGwJIhjJpDo_yw3gjUE3RmEB0e2JDUQ,1671
3
3
  gl_observability/__init__.pyi,sha256=YvrsoNmib8ulmQtWz9yxKyHDWnsTxzLWXOiI5C-BqmM,518
4
4
  gl_observability/initializer.pyi,sha256=T8_r7zuT8zrVofPemaS-9TEliOy0iqR-hAgq6sPGN6I,3524
@@ -8,13 +8,13 @@ gl_observability/logs/regex_pii_logger_handler.pyi,sha256=mN9pAOn8t3GrEjM7hldAn2
8
8
  gl_observability/traces/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  gl_observability/traces/config.pyi,sha256=E-U-Sda2CL4VKXQPTkGdwLSB230jusIHHbFKW8hC98I,1982
10
10
  gl_observability/traces/backend/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- gl_observability/traces/backend/opentelemetry.pyi,sha256=VaQPBEHHhLT4elEcjll0DgQTIb9RW5BSWqEI8It3cdo,1460
11
+ gl_observability/traces/backend/opentelemetry.pyi,sha256=jXsw3ZG2PnT0VWuC23yjQHaPMit3mF8m-C8LFeEBruo,1460
12
12
  gl_observability/traces/backend/sentry.pyi,sha256=dVrmxAc5F7vZym3NQ6G7gCynuwa_TkstodEkFSvdhbs,2049
13
13
  gl_observability/traces/instrument/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  gl_observability/traces/instrument/functions.pyi,sha256=Hd2CmrBF4qxjb_LEUf5jgljVJ1DKy7XiQXJzvpYTl5w,4293
15
15
  gl_observability/traces/instrument/http.pyi,sha256=F86Nscqe9GxNdEduPJepzzjg3EeLZL-zRMUSj7tPxRg,2033
16
16
  gl_observability.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
17
- gl_observability_binary-0.1.0.dist-info/METADATA,sha256=l-feSdIDQ99lCJ-qXF6jmekmDswcojtMmNa-4n3zagc,7429
18
- gl_observability_binary-0.1.0.dist-info/WHEEL,sha256=x5rgv--I0NI0IT1Lh9tN1VG2cI637p3deednwYLKnxc,96
19
- gl_observability_binary-0.1.0.dist-info/top_level.txt,sha256=qX0-e4NxRAAXXjWIZ7gvIspQP7J_dgxPQ7e3-WEbIeQ,17
20
- gl_observability_binary-0.1.0.dist-info/RECORD,,
17
+ gl_observability_binary-0.1.1.dist-info/METADATA,sha256=wWLm2SHd2xY9o1ae3TP2RWO-rh8H2yQXJJwE7P2rVMg,8259
18
+ gl_observability_binary-0.1.1.dist-info/WHEEL,sha256=x5rgv--I0NI0IT1Lh9tN1VG2cI637p3deednwYLKnxc,96
19
+ gl_observability_binary-0.1.1.dist-info/top_level.txt,sha256=qX0-e4NxRAAXXjWIZ7gvIspQP7J_dgxPQ7e3-WEbIeQ,17
20
+ gl_observability_binary-0.1.1.dist-info/RECORD,,