- 필수 기능
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- 디지털 경험
- 소프트웨어 제공
- 보안
- 로그 관리
- 관리
- 인프라스트럭처
- ci
- containers
- csm
- ndm
- otel_guides
- overview
- slos
- synthetics
- tests
- 워크플로
OpenTracing support is included in the ddtrace
package. Use pip
to install the required opentracing
package:
pip install ddtrace[opentracing]
The OpenTracing convention for initializing a tracer is to define an initialization method that configures and instantiates a new tracer and overwrites the global opentracing.tracer
reference:
import time
import opentracing
from ddtrace.opentracer import Tracer, set_global_tracer
def init_tracer(service_name):
config = {
"agent_hostname": "localhost",
"agent_port": 8126,
}
tracer = Tracer(service_name, config=config)
set_global_tracer(tracer)
return tracer
def my_operation():
span = opentracing.tracer.start_span("<OPERATION_NAME>")
span.set_tag("<TAG_KEY>", "<TAG_VALUE>")
time.sleep(0.05)
span.finish()
init_tracer("<SERVICE_NAME>")
my_operation()
The tracer can now be used like in any other OpenTracing application. See opentracing.io for OpenTracing Python usage.