update
This commit is contained in:
parent
bb48329fee
commit
a5bd63df91
@ -35,5 +35,4 @@ WORKDIR /workspace
|
|||||||
ENV PYTHONPATH="."
|
ENV PYTHONPATH="."
|
||||||
ENV TZ="Asia/Ho_Chi_Minh"
|
ENV TZ="Asia/Ho_Chi_Minh"
|
||||||
|
|
||||||
CMD [ "sh", "run.sh"]
|
CMD [ "sh", "run.sh"]
|
||||||
# ENTRYPOINT [ "sleep", "infinity" ]
|
|
26
cope2n-api/fwd/opentelemetry_config.py
Normal file
26
cope2n-api/fwd/opentelemetry_config.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
from opentelemetry import metrics, trace
|
||||||
|
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import \
|
||||||
|
OTLPSpanExporter
|
||||||
|
from opentelemetry.exporter.otlp.proto.http.metric_exporter import \
|
||||||
|
OTLPMetricExporter
|
||||||
|
from opentelemetry.instrumentation.django import DjangoInstrumentor
|
||||||
|
from opentelemetry.sdk.metrics import MeterProvider
|
||||||
|
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
|
||||||
|
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
|
||||||
|
from opentelemetry.sdk.trace import TracerProvider
|
||||||
|
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
||||||
|
|
||||||
|
|
||||||
|
def setup_tracing():
|
||||||
|
# Set up a tracer provider
|
||||||
|
trace.set_tracer_provider(TracerProvider())
|
||||||
|
|
||||||
|
# Configure the OTLP exporter
|
||||||
|
otlp_exporter = OTLPSpanExporter(endpoint="http://localhost:4317", insecure=True)
|
||||||
|
|
||||||
|
# Add a BatchSpanProcessor to handle traces
|
||||||
|
span_processor = BatchSpanProcessor(otlp_exporter)
|
||||||
|
trace.get_tracer_provider().add_span_processor(span_processor)
|
||||||
|
|
||||||
|
# Instrument Django
|
||||||
|
DjangoInstrumentor().instrument()
|
Loading…
Reference in New Issue
Block a user