Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerHYang committed Jan 25, 2024
1 parent dcdc3f3 commit f50d0b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os

from langchain_openai import ChatOpenAI
from openinference.instrumentation.langchain import LangChainInstrumentor
from opentelemetry import trace as trace_api
Expand All @@ -11,15 +9,10 @@
resource = Resource(attributes={})
tracer_provider = trace_sdk.TracerProvider(resource=resource)
trace_api.set_tracer_provider(tracer_provider=tracer_provider)

# Logs to the Phoenix Collector if running locally
if os.environ.get("PHOENIX_COLLECTOR_ENDPOINT"):
endpoint = os.environ["PHOENIX_COLLECTOR_ENDPOINT"] + "/v1/traces"
span_otlp_exporter = OTLPSpanExporter(endpoint=endpoint)
tracer_provider.add_span_processor(SimpleSpanProcessor(span_exporter=span_otlp_exporter))
else:
span_console_exporter = ConsoleSpanExporter()
tracer_provider.add_span_processor(SimpleSpanProcessor(span_exporter=span_console_exporter))
span_otlp_exporter = OTLPSpanExporter(endpoint="http://127.0.0.1:6006/v1/traces")
tracer_provider.add_span_processor(SimpleSpanProcessor(span_exporter=span_otlp_exporter))
span_console_exporter = ConsoleSpanExporter()
tracer_provider.add_span_processor(SimpleSpanProcessor(span_exporter=span_console_exporter))

LangChainInstrumentor().instrument()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
langchain_openai
opentelemetry-sdk
opentelemetry-exporter-otlp
openinference-instrumentation-langchain

0 comments on commit f50d0b5

Please sign in to comment.