-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7e258b
commit 575a3fd
Showing
2 changed files
with
23 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from openinference.instrumentation.llama_index import LlamaIndexInstrumentor | ||
from opentelemetry import trace as trace_api | ||
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter | ||
from opentelemetry.sdk import trace as trace_sdk | ||
from opentelemetry.sdk.resources import Resource | ||
from opentelemetry.sdk.trace.export import SimpleSpanProcessor | ||
|
||
|
||
def instrument(): | ||
resource = Resource(attributes={}) | ||
tracer_provider = trace_sdk.TracerProvider(resource=resource) | ||
span_exporter = OTLPSpanExporter(endpoint="http://phoenix:6006/v1/traces") | ||
span_processor = SimpleSpanProcessor(span_exporter=span_exporter) | ||
tracer_provider.add_span_processor(span_processor=span_processor) | ||
trace_api.set_tracer_provider(tracer_provider=tracer_provider) | ||
LlamaIndexInstrumentor().instrument() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters