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

switched from jaeger to OTLP exporter #700

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ opentelemetry-sdk
opentelemetry-instrumentation
opentelemetry-instrumentation-django
opentelemetry-exporter-jaeger
opentelemetry-exporter-otlp-proto-grpc
opentelemetry-instrumentation-requests
opentelemetry-instrumentation-celery
brotli
Expand Down
17 changes: 7 additions & 10 deletions tr_sys/tr_sys/otel_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@
from opentelemetry import trace
from opentelemetry.sdk.resources import SERVICE_NAME as telemetery_service_name_key, Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter, SimpleSpanProcessor
from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter
from opentelemetry.instrumentation.django import DjangoInstrumentor
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.instrumentation.celery import CeleryInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor
from celery.signals import worker_process_init


def configure_opentelemetry():

#jaeger_host = os.environ.get('JAEGER_HOST', 'jaeger-otel-agent')
#jaeger_port = int(os.environ.get('JAEGER_PORT', '6831'))
logging.info('About to instrument ARS app for OTEL')
try:
jaeger_host= 'jaeger-otel-agent.sri'
jaeger_port= 6831
otlp_host = os.environ.get('OTLP_HOST', 'jaeger-otel-collector.sri')
otlp_port = int(os.environ.get('OTLP_PORT', '4317'))
service_name= 'ARS'
resource = Resource.create({telemetery_service_name_key: service_name})

Expand All @@ -27,12 +25,11 @@ def configure_opentelemetry():
tracer_provider = trace.get_tracer_provider()

# Configure Jaeger Exporter
jaeger_exporter = JaegerExporter(
agent_host_name=jaeger_host,
agent_port=jaeger_port,
OTLP_exporter = OTLPSpanExporter(
endpoint=f"http://{otlp_host}:{otlp_port}"
)

span_processor = SimpleSpanProcessor(jaeger_exporter)
span_processor = BatchSpanProcessor(OTLP_exporter)
tracer_provider.add_span_processor(span_processor)

# Optional: Console exporter for debugging
Expand Down