Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use oitracer #5617

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/phoenix-otel/src/phoenix/otel/otel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast
from urllib.parse import ParseResult, urlparse

from openinference.instrumentation import ( # type: ignore[import-untyped]
OITracerProvider as _OITracerProvider,
)
from openinference.instrumentation import (
TraceConfig as _TraceConfig,
)
from openinference.semconv.resource import ResourceAttributes as _ResourceAttributes
from opentelemetry import trace as trace_api
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import (
Expand Down Expand Up @@ -40,7 +46,7 @@ def register(
set_global_tracer_provider: bool = True,
headers: Optional[Dict[str, str]] = None,
verbose: bool = True,
) -> _TracerProvider:
) -> _OITracerProvider:
"""
Creates an OpenTelemetry TracerProvider for enabling OpenInference tracing.

Expand All @@ -66,7 +72,9 @@ def register(

project_name = project_name or get_env_project_name()
resource = Resource.create({PROJECT_NAME: project_name})
tracer_provider = TracerProvider(resource=resource, verbose=False)
tracer_provider = _OITracerProvider(
TracerProvider(resource=resource, verbose=False), _TraceConfig()
)
span_processor: SpanProcessor
if batch:
span_processor = BatchSpanProcessor(endpoint=endpoint, headers=headers)
Expand Down
Loading