Created
September 8, 2022 15:01
-
-
Save vanga/70b5e18552456605445d10564e030b89 to your computer and use it in GitHub Desktop.
Sample flask application with Elastic APM integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from elasticapm.contrib.flask import ElasticAPM | |
from flask import request | |
app = Flask(__name__) | |
app.config['ELASTIC_APM'] = { | |
'SERVICE_NAME': 'flask', | |
'SERVER_URL': 'https://<apm-server-ip/dns>.com:8200', | |
'SERVER_CERT': 'path to elk.example.com/elk.example.com.crt', | |
'SERVER_TIMEOUT': '5s', | |
'SECRET_TOKEN': '<secret-token-configured-in-apm>', | |
'DEBUG': True | |
} | |
apm = ElasticAPM(app) | |
@app.route('/health') | |
def health(): | |
return "OK" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment