Add opentelemtry distro

main
Drew Bednar 11 months ago
parent be8ace4b7e
commit 0f39624765

@ -39,6 +39,7 @@ nodeenv==1.8.0
# via pre-commit # via pre-commit
packaging==23.2 packaging==23.2
# via # via
# -c ./requirements.txt
# black # black
# build # build
# pytest # pytest

@ -0,0 +1,24 @@
import logging
from random import randint
from flask import Flask
from flask import request
app = Flask(__name__)
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@app.route("/rolldice")
def roll_dice():
player = request.args.get('player', default=None, type=str)
result = str(roll())
if player:
logger.warn("%s is rolling the dice: %s", player, result)
else:
logger.warn("Anonymous player is rolling the dice: %s", result)
return result
def roll():
return randint(1, 6)

@ -1,5 +0,0 @@
class Example:
"""An example class"""
def __init__(self, name):
self.name = name

@ -1,2 +1,4 @@
flask<3 flask<3
gunicorn
opentelemetry-distro
werkzeug<3 werkzeug<3

@ -8,8 +8,14 @@ blinker==1.7.0
# via flask # via flask
click==8.1.7 click==8.1.7
# via flask # via flask
deprecated==1.2.14
# via opentelemetry-api
flask==2.3.3 flask==2.3.3
# via -r requirements.in # via -r requirements.in
gunicorn==21.2.0
# via -r requirements.in
importlib-metadata==6.11.0
# via opentelemetry-api
itsdangerous==2.1.2 itsdangerous==2.1.2
# via flask # via flask
jinja2==3.1.3 jinja2==3.1.3
@ -18,7 +24,33 @@ markupsafe==2.1.5
# via # via
# jinja2 # jinja2
# werkzeug # werkzeug
opentelemetry-api==1.22.0
# via
# opentelemetry-distro
# opentelemetry-instrumentation
# opentelemetry-sdk
opentelemetry-distro==0.43b0
# via -r requirements.in
opentelemetry-instrumentation==0.43b0
# via opentelemetry-distro
opentelemetry-sdk==1.22.0
# via opentelemetry-distro
opentelemetry-semantic-conventions==0.43b0
# via opentelemetry-sdk
packaging==23.2
# via gunicorn
typing-extensions==4.9.0
# via opentelemetry-sdk
werkzeug==2.3.8 werkzeug==2.3.8
# via # via
# -r requirements.in # -r requirements.in
# flask # flask
wrapt==1.16.0
# via
# deprecated
# opentelemetry-instrumentation
zipp==3.17.0
# via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
# setuptools

@ -2,7 +2,7 @@ import os
from invoke import task from invoke import task
IMAGE_RESPOSITORY = os.environ.get("IMAGE_RESPOSITORY", "registry.runcible.io/learn_otel") IMAGE_RESPOSITORY = os.environ.get("IMAGE_RESPOSITORY", "registry.runcible.io/learn-otel")
@task @task
@ -50,3 +50,8 @@ def build_image(c, dev=True, registry_user=None, registry_token=None, push=False
c.run(f"docker login -u {registry_user} -p {registry_token}") c.run(f"docker login -u {registry_user} -p {registry_token}")
if push: if push:
c.run(f"docker push {image_name}") c.run(f"docker push {image_name}")
@task
def serve_dev(c):
c.run("FLASK_APP=./learn_otel/app.py flask run -p 8888")

Loading…
Cancel
Save