OpenTelemetry SDK for Coalex.ai with OTLP integration
Project description
Coalex SDK
A Python package for OpenTelemetry integration with Coalex.ai observability platform.
Installation
pip install coalex
Quick Start with VertexAI
from coalex.otel import register, coalex_context
from openinference.instrumentation.vertexai import VertexAIInstrumentor
from vertexai.generative_models import GenerativeModel
# Register Coalex tracing
tracer_provider = register(
agent_id="YOUR_AGENT_ID"
)
# Instrument VertexAI with Coalex tracer
VertexAIInstrumentor().instrument(tracer_provider=tracer_provider)
# Create model instance
model = GenerativeModel("gemini-2.0-flash")
# Use coalex_context for proper span management and attribute propagation
with coalex_context(
request_id="req_vertex_001",
prompt_version="v1.0.0"
):
# Generate content - this will be automatically traced with proper context
response = model.generate_content(
"Write a haiku about artificial intelligence.",
generation_config={
"max_output_tokens": 100,
"temperature": 0.7,
}
)
print("Generated haiku:")
print(response.text)
Features
- Simple Setup: One-line registration with
register() - Coalex Integration: Default endpoint for Coalex observability platform
- Context Management: Use
coalex_context()for proper span hierarchy and attribute propagation - OpenInference Compatible: Works with all OpenInference instrumentors
- Authentication: Automatic authentication using agent_id
Configuration
agent_id: Your unique agent identifier (required for authentication)endpoint: OTLP endpoint (defaults to Coalex:https://traces.coalex.ai/v1/traces)
Example
See examples/vertexai_example.py for a complete working example including:
- Basic content generation
- Streaming responses
- Proper error handling
- Context management with
coalex_context()
To run the example, install the additional dependencies:
pip install google-cloud-aiplatform openinference-instrumentation-vertexai
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coalex-0.4.3.tar.gz.
File metadata
- Download URL: coalex-0.4.3.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
950578eae74c8ef0262b7561ff2939e5e319c329d507725b3ffdadafe0f128ae
|
|
| MD5 |
8be741fc1247dd5991dcd0435e3c0a86
|
|
| BLAKE2b-256 |
04f8508e96f6f0230fa2b140ac4a455a6d570474da58f2064e8a649c42a109a9
|
Provenance
The following attestation bundles were made for coalex-0.4.3.tar.gz:
Publisher:
publish.yml on carlosmlribeiro/coalex.ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coalex-0.4.3.tar.gz -
Subject digest:
950578eae74c8ef0262b7561ff2939e5e319c329d507725b3ffdadafe0f128ae - Sigstore transparency entry: 720990862
- Sigstore integration time:
-
Permalink:
carlosmlribeiro/coalex.ai@15e2dfe48882cb89ca66c60b3c12174cba92c874 -
Branch / Tag:
refs/tags/v0.4.3 - Owner: https://github.com/carlosmlribeiro
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@15e2dfe48882cb89ca66c60b3c12174cba92c874 -
Trigger Event:
push
-
Statement type:
File details
Details for the file coalex-0.4.3-py3-none-any.whl.
File metadata
- Download URL: coalex-0.4.3-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c2f5a0828820012fe031bdbe12cc96ba6d5ab1b0e911185828d2acf86ac6a5e
|
|
| MD5 |
cabe7d6b4548fa534ae0b6ef787fa00b
|
|
| BLAKE2b-256 |
387872a7064c168618a925e7c468b1f150ac0fb0a07671cdbe4714d20c151436
|
Provenance
The following attestation bundles were made for coalex-0.4.3-py3-none-any.whl:
Publisher:
publish.yml on carlosmlribeiro/coalex.ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coalex-0.4.3-py3-none-any.whl -
Subject digest:
6c2f5a0828820012fe031bdbe12cc96ba6d5ab1b0e911185828d2acf86ac6a5e - Sigstore transparency entry: 720990904
- Sigstore integration time:
-
Permalink:
carlosmlribeiro/coalex.ai@15e2dfe48882cb89ca66c60b3c12174cba92c874 -
Branch / Tag:
refs/tags/v0.4.3 - Owner: https://github.com/carlosmlribeiro
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@15e2dfe48882cb89ca66c60b3c12174cba92c874 -
Trigger Event:
push
-
Statement type: