Skip to content

Instantly share code, notes, and snippets.

@vanga
Created September 8, 2022 15:01
Show Gist options
  • Save vanga/70b5e18552456605445d10564e030b89 to your computer and use it in GitHub Desktop.
Save vanga/70b5e18552456605445d10564e030b89 to your computer and use it in GitHub Desktop.
Sample flask application with Elastic APM integration
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