-
Notifications
You must be signed in to change notification settings - Fork 0
Converter/fix prometheus metrics export #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
|
|
converter/converter/converter.py
Outdated
| return jsonify({"error": message}), code | ||
|
|
||
|
|
||
| def extract_message_type_from_paylaod(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract_message_type_from_paylaod --> extract_message_type_from_payload
converter/converter/converter.py
Outdated
| "The number of seconds it took to the /convert endpoint to answer", | ||
| labels={ | ||
| "status": lambda r: r.status_code, | ||
| "message_type": extract_message_type_from_paylaod, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A voir si c'est pertinent mais je ne sais pas a quel fréquence cette méthode va être rappeler par la métrique histograme. Est ce que ce ne serais pas mieux de le faire dans un before_request pour éviter tout appel supplémentaire inutile si on a pas la garantie que la fonction ne sera appeler qu'une seule fois ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D'après la lib la fonction est appellée à chaque execution de la méthode décorée. Pourquoi y aurait-il des executions non souhaitées ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je ne sais pas exactement comment les métriques sont récolter tout au long de l'exécution de la fonction pour l'histogramme contrairement a d'autre métrique comme le count qui est exécuter qu'une fois par exemple.
Si tu es positif que ce n'est exécuter qu'une fois, c'est ok pour moi
Vu que les labels sont afficher sur chaques métrique lié a l'histogramme, je me demandais si a chaque fois qu'on va récolter une métrique pour l'histogramme, est ce que ça va re-exectuer la méthode pour avoir le message_type.
|
🔎 Détails
prometheus-clientparflask-prometheus-exporterNote : il y a potentiellement un impact sur le converter car il faut passer par un partage de fichier entre les différents worker générés par la commande Gunicorn. Normalement la taille de ces fichiers est capée (et géré par la librairie) pour éviter un overflow du file system au sein du container.
✅ Fonctionnement validé
📸 Captures d'écran