Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbdias committed Sep 17, 2024
1 parent df46f84 commit 4e5e5bc
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 25 deletions.
2 changes: 2 additions & 0 deletions examples/quick-start-llm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
_venv
.env

app/__pycache__
8 changes: 0 additions & 8 deletions examples/quick-start-llm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,3 @@ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=localhost:4317 \
opentelemetry-instrument \
streamlit run ./app/streamlit_app.py
```

### References

- https://github.com/openlit/openlit?tab=readme-ov-file#-getting-started
- https://github.com/langchain-ai/langchain
- https://github.com/streamlit/streamlit
- https://docs.streamlit.io/develop/api-reference
- https://wandb.ai/site
Binary file not shown.
Binary file not shown.
Binary file not shown.
20 changes: 3 additions & 17 deletions examples/quick-start-llm/app/telemetry.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

from traceloop.sdk import Traceloop

Expand All @@ -12,24 +9,13 @@
otlp_endpoint = os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT", "localhost:4317")
otlp_service_name = os.getenv("OTEL_SERVICE_NAME", "quick-start-llm")

resource = Resource(attributes={
SERVICE_NAME: otlp_service_name
})

provider = TracerProvider(resource=resource)

processor = BatchSpanProcessor(
OTLPSpanExporter(endpoint=otlp_endpoint, insecure=True)
)
provider.add_span_processor(processor)

trace.set_tracer_provider(provider)

def init():
tracer = trace.get_tracer(otlp_service_name)

Traceloop.init(
exporter=OTLPSpanExporter(endpoint=otlp_endpoint, insecure=True)
exporter=OTLPSpanExporter(endpoint=otlp_endpoint, insecure=True),
disable_batch=True,
should_enrich_metrics=True
)

return tracer
Expand Down

0 comments on commit 4e5e5bc

Please sign in to comment.