Skip to content

Commit 9367d2b

Browse files
style: run ruff format on all examples
1 parent b4b3b0c commit 9367d2b

38 files changed

Lines changed: 304 additions & 228 deletions

File tree

examples/example-ai-anthropic/chat.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
1111
from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor
1212

13-
resource = Resource(attributes={
14-
SERVICE_NAME: "example-anthropic-app",
15-
"posthog.distinct_id": "example-user",
16-
"foo": "bar",
17-
"conversation_id": "abc-123",
18-
})
13+
resource = Resource(
14+
attributes={
15+
SERVICE_NAME: "example-anthropic-app",
16+
"posthog.distinct_id": "example-user",
17+
"foo": "bar",
18+
"conversation_id": "abc-123",
19+
}
20+
)
1921
exporter = OTLPSpanExporter(
2022
endpoint=f"{os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')}/i/v0/ai/otel",
2123
headers={"Authorization": f"Bearer {os.environ['POSTHOG_API_KEY']}"},

examples/example-ai-anthropic/extended_thinking.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
1212
from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor
1313

14-
resource = Resource(attributes={
15-
SERVICE_NAME: "example-anthropic-app",
16-
"posthog.distinct_id": "example-user",
17-
"foo": "bar",
18-
"conversation_id": "abc-123",
19-
})
14+
resource = Resource(
15+
attributes={
16+
SERVICE_NAME: "example-anthropic-app",
17+
"posthog.distinct_id": "example-user",
18+
"foo": "bar",
19+
"conversation_id": "abc-123",
20+
}
21+
)
2022
exporter = OTLPSpanExporter(
2123
endpoint=f"{os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')}/i/v0/ai/otel",
2224
headers={"Authorization": f"Bearer {os.environ['POSTHOG_API_KEY']}"},

examples/example-ai-anthropic/streaming.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
99
from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor
1010

11-
resource = Resource(attributes={
12-
SERVICE_NAME: "example-anthropic-app",
13-
"posthog.distinct_id": "example-user",
14-
"foo": "bar",
15-
"conversation_id": "abc-123",
16-
})
11+
resource = Resource(
12+
attributes={
13+
SERVICE_NAME: "example-anthropic-app",
14+
"posthog.distinct_id": "example-user",
15+
"foo": "bar",
16+
"conversation_id": "abc-123",
17+
}
18+
)
1719
exporter = OTLPSpanExporter(
1820
endpoint=f"{os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')}/i/v0/ai/otel",
1921
headers={"Authorization": f"Bearer {os.environ['POSTHOG_API_KEY']}"},

examples/example-ai-autogen/agent.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
1010
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor
1111

12-
resource = Resource(attributes={
13-
SERVICE_NAME: "example-autogen-app",
14-
"posthog.distinct_id": "example-user",
15-
"foo": "bar",
16-
"conversation_id": "abc-123",
17-
})
12+
resource = Resource(
13+
attributes={
14+
SERVICE_NAME: "example-autogen-app",
15+
"posthog.distinct_id": "example-user",
16+
"foo": "bar",
17+
"conversation_id": "abc-123",
18+
}
19+
)
1820
exporter = OTLPSpanExporter(
1921
endpoint=f"{os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')}/i/v0/ai/otel",
2022
headers={"Authorization": f"Bearer {os.environ['POSTHOG_API_KEY']}"},

examples/example-ai-aws-bedrock/chat.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
1010
from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
1111

12-
resource = Resource(attributes={
13-
SERVICE_NAME: "example-bedrock-app",
14-
"posthog.distinct_id": "example-user",
15-
"foo": "bar",
16-
"conversation_id": "abc-123",
17-
})
12+
resource = Resource(
13+
attributes={
14+
SERVICE_NAME: "example-bedrock-app",
15+
"posthog.distinct_id": "example-user",
16+
"foo": "bar",
17+
"conversation_id": "abc-123",
18+
}
19+
)
1820

1921
exporter = OTLPSpanExporter(
2022
endpoint=f"{os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')}/i/v0/ai/otel",

examples/example-ai-azure-openai/chat.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
from opentelemetry.sdk.trace import TracerProvider
1010
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
1111

12-
resource = Resource(attributes={
13-
SERVICE_NAME: "example-azure-openai-app",
14-
"posthog.distinct_id": "example-user",
15-
"foo": "bar",
16-
"conversation_id": "abc-123",
17-
})
12+
resource = Resource(
13+
attributes={
14+
SERVICE_NAME: "example-azure-openai-app",
15+
"posthog.distinct_id": "example-user",
16+
"foo": "bar",
17+
"conversation_id": "abc-123",
18+
}
19+
)
1820
exporter = OTLPSpanExporter(
1921
endpoint=f"{os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')}/i/v0/ai/otel",
2022
headers={"Authorization": f"Bearer {os.environ['POSTHOG_API_KEY']}"},

examples/example-ai-cerebras/chat.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
99
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor
1010

11-
resource = Resource(attributes={
12-
SERVICE_NAME: "example-cerebras-app",
13-
"posthog.distinct_id": "example-user",
14-
"foo": "bar",
15-
"conversation_id": "abc-123",
16-
})
11+
resource = Resource(
12+
attributes={
13+
SERVICE_NAME: "example-cerebras-app",
14+
"posthog.distinct_id": "example-user",
15+
"foo": "bar",
16+
"conversation_id": "abc-123",
17+
}
18+
)
1719

1820
exporter = OTLPSpanExporter(
1921
endpoint=f"{os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')}/i/v0/ai/otel",

examples/example-ai-cohere/chat.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
99
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor
1010

11-
resource = Resource(attributes={
12-
SERVICE_NAME: "example-cohere-app",
13-
"posthog.distinct_id": "example-user",
14-
"foo": "bar",
15-
"conversation_id": "abc-123",
16-
})
11+
resource = Resource(
12+
attributes={
13+
SERVICE_NAME: "example-cohere-app",
14+
"posthog.distinct_id": "example-user",
15+
"foo": "bar",
16+
"conversation_id": "abc-123",
17+
}
18+
)
1719

1820
exporter = OTLPSpanExporter(
1921
endpoint=f"{os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')}/i/v0/ai/otel",

examples/example-ai-deepseek/chat.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
99
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor
1010

11-
resource = Resource(attributes={
12-
SERVICE_NAME: "example-deepseek-app",
13-
"posthog.distinct_id": "example-user",
14-
"foo": "bar",
15-
"conversation_id": "abc-123",
16-
})
11+
resource = Resource(
12+
attributes={
13+
SERVICE_NAME: "example-deepseek-app",
14+
"posthog.distinct_id": "example-user",
15+
"foo": "bar",
16+
"conversation_id": "abc-123",
17+
}
18+
)
1719

1820
exporter = OTLPSpanExporter(
1921
endpoint=f"{os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')}/i/v0/ai/otel",

examples/example-ai-fireworks-ai/chat.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
99
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor
1010

11-
resource = Resource(attributes={
12-
SERVICE_NAME: "example-fireworks-ai-app",
13-
"posthog.distinct_id": "example-user",
14-
"foo": "bar",
15-
"conversation_id": "abc-123",
16-
})
11+
resource = Resource(
12+
attributes={
13+
SERVICE_NAME: "example-fireworks-ai-app",
14+
"posthog.distinct_id": "example-user",
15+
"foo": "bar",
16+
"conversation_id": "abc-123",
17+
}
18+
)
1719

1820
exporter = OTLPSpanExporter(
1921
endpoint=f"{os.environ.get('POSTHOG_HOST', 'https://us.i.posthog.com')}/i/v0/ai/otel",

0 commit comments

Comments
 (0)