Skip to content

Instantly share code, notes, and snippets.

@Lucho00Cuba
Last active November 23, 2022 20:15
Show Gist options
  • Select an option

  • Save Lucho00Cuba/7ab21165878f4fe75029eee5f0ea7264 to your computer and use it in GitHub Desktop.

Select an option

Save Lucho00Cuba/7ab21165878f4fe75029eee5f0ea7264 to your computer and use it in GitHub Desktop.
Client-APM
#!/usr/bin/env python3
from flask import Flask
from elasticapm.contrib.flask import ElasticAPM
import elasticapm
server_url = 'http://APM-SERVER:8200'
service_name = 'DemoFlask'
environment = 'dev'
app = Flask(__name__)
apm = ElasticAPM(app, server_url=server_url, service_name=service_name, environment=environment)
@app.before_request
def apm_log():
elasticapm.label(platform = 'DemoPlatform', application = 'DemoApplication')
@app.route('/')
def main():
return "Home Page"
@app.route('/hello-world/')
def helloWorld():
return "Hello World"
app.run(host="0.0.0.0", port=8080)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment