Commit 99446daf authored by Nane Kratzke's avatar Nane Kratzke
Browse files

Improved hiphop service

parent e24f2186
Pipeline #29731 passed with stages
in 30 seconds
from flask import Flask, redirect, request
import requests, traceback, os
import requests, os, logging
from elasticapm.contrib.flask import ElasticAPM
# A very boring and basic hip-hop-service to demonstrate
# observability via tracing.
# observability via tracing across multiple services.
service = os.environ.get('HIPHOP', 'hiphop')
tier = int(os.environ.get('TIER', '1'))
app = Flask(__name__)
apm = ElasticAPM(app,
service_name=os.environ.get('HIPHOP', 'hiphop'),
)
apm = ElasticAPM(app, service_name=service)
@app.route('/')
def index():
......@@ -17,15 +16,13 @@ def index():
@app.route('/hip')
def hip():
print(request.headers)
r = ""
url = f"http://{service}-{tier + 1}/hip"
try:
url = f"http://{service}-{tier + 1}/hip"
r = requests.get(url)
r = r.content.decode('utf-8')
except Exception as ex:
print(ex)
traceback.print_exc()
logging.error(f"Fetching { url } failed ({ ex })")
r = "END"
hip = "hip " if tier == 1 else ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment