Setting up Elastic-APM python

1.9k views Asked by At

My team already has kibana account in which all project logs come up. Now how do I set up elastic APM on my python-fast API project?

How to set up APM Server and get the SERVER_URL to use in my project - APM Server

What is GLOBAL_LABELS and in which case is it used?

apm_config = {
    'SERVICE_NAME': 'server',
    'SERVER_URL': 'http://localhost:8200',
    'ENVIRONMENT': 'env',
    'GLOBAL_LABELS': 'platform=Demo, application=demo_testing'
}

apm = make_apm_client(apm_config)

app.add_middleware(ElasticAPM, client=apm)
1

There are 1 answers

0
Colton Myers On

GLOBAL_LABELS defines labels that will be added to every transaction that the APM Agent generates. You can also add a label on the fly via elasticapm.label().

You can get your secret_token out of your APM Server config. Or, if you're using Elastic Cloud you can go to the APM page in Kibana, click "Add Data" at the top right, then scroll down and you can get your secret_token/server_url from the sample config.

add data

sample config