tencent cloud

All product documents
Tencent Cloud Observability Platform
DocumentationTencent Cloud Observability Platform
Reporting over Jaeger Protocol
Last updated: 2024-11-01 18:13:50
Reporting over Jaeger Protocol
Last updated: 2024-11-01 18:13:50
This document describes how to report the data of a Python application over the Jaeger protocol.

Directions

Step 1. Get the endpoint and token

Log in to the APM console, enter the Application monitoring > Application list page, click Access application, and select the Python language and Jaeger data collection method. Then, get the endpoint and token in the step of access method selection.



Step 2. Install the Jaeger agent

1. Download the Jaeger agent.
2. Run the following command to start the agent:
nohup ./jaeger-agent --reporter.grpc.host-port={{endpoint}} --jaeger.tags=token={{token}}

Step 3. Report data through Jaeger

1. Run the following command to install the jaeger_client package.
pip install jaeger_client
2. Create the following Python file and tracer object to trace all requests.
from jaeger_client import Config
import time
from os import getenv

# Configure the address of the Jaeger agent, which is the localhost by default.
JAEGER_HOST = getenv('JAEGER_HOST', 'localhost')
SERVICE_NAME = getenv('JAEGER_HOST', 'my_service_test')


def build_your_span(tracer):
with tracer.start_span('yourTestSpan') as span:
span.log_kv({'event': 'test your message', 'life': 42})
span.set_tag("span.kind", "server")
return span


def build_your_tracer():
my_config = Config(
config={
'sampler': {
'type': 'const',
'param': 1,
},
'local_agent': {
'reporting_host': JAEGER_HOST,
'reporting_port': 6831,
},
'logging': True,
},
service_name=SERVICE_NAME,
validate=True
)
tracer = my_config.initialize_tracer()

return tracer


if __name__ == "__main__":
tracer = build_your_tracer()
span = build_your_span(tracer)
time.sleep(2)
tracer.close()
Note:
Currently, Jaeger supports frameworks such as Flask, Django, and gRPC for data reporting. For more information, see the following documents:
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon