mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
doc - OTEL trace propogation
This commit is contained in:
parent
d829e6a297
commit
d7f1445615
3 changed files with 67 additions and 0 deletions
21
litellm/proxy/tests/test_simple_traceparent_openai.py
Normal file
21
litellm/proxy/tests/test_simple_traceparent_openai.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
# mypy: ignore-errors
|
||||
import openai
|
||||
import uuid
|
||||
|
||||
client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000")
|
||||
example_traceparent = f"00-80e1afed08e019fc1110464cfa66635c-02e80198930058d4-01"
|
||||
extra_headers = {"traceparent": example_traceparent}
|
||||
_trace_id = example_traceparent.split("-")[1]
|
||||
|
||||
print("EXTRA HEADERS: ", extra_headers)
|
||||
print("Trace ID: ", _trace_id)
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model="llama3",
|
||||
messages=[
|
||||
{"role": "user", "content": "this is a test request, write a short poem"}
|
||||
],
|
||||
extra_headers=extra_headers,
|
||||
)
|
||||
|
||||
print(response)
|
Loading…
Add table
Add a link
Reference in a new issue