Commit 220fd813 authored by Nane Kratzke's avatar Nane Kratzke
Browse files

Improved service naming

parent 2aac41dd
Pipeline #29753 passed with stages
in 41 seconds
...@@ -12,7 +12,7 @@ service = os.environ.get('HIPHOP', 'hiphop') ...@@ -12,7 +12,7 @@ service = os.environ.get('HIPHOP', 'hiphop')
tier = int(os.environ.get('TIER', '1')) tier = int(os.environ.get('TIER', '1'))
app = Flask(__name__) app = Flask(__name__)
apm = ElasticAPM(app, apm = ElasticAPM(app,
service_name=os.environ.get('SERVICE', 'space'), service_name=f"{ service }-{ tier }",
) )
@app.route('/') @app.route('/')
...@@ -23,9 +23,9 @@ def index(): ...@@ -23,9 +23,9 @@ def index():
def hip(): def hip():
logging.info(f"Request from { request.remote_addr } with headers { json.dumps(dict(request.headers)) }") logging.info(f"Request from { request.remote_addr } with headers { json.dumps(dict(request.headers)) }")
r = "" r = ""
url = f"http://{service}-{tier + 1}/hip" url = f"http://{ service }-{ tier + 1 }/hip"
try: try:
with elasticapm.capture_span(f"{service}-{tier + 1}"): with elasticapm.capture_span(f"{ service }-{ tier + 1 }"):
r = requests.get(url).content r = requests.get(url).content
except Exception as ex: except Exception as ex:
logging.error(f"Fetching { url } failed ({ ex })") logging.error(f"Fetching { url } failed ({ ex })")
......
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