Last active
November 23, 2022 20:15
-
-
Save Lucho00Cuba/7ab21165878f4fe75029eee5f0ea7264 to your computer and use it in GitHub Desktop.
Client-APM
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
| #!/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