All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Login


All New Login

All gists matching topic prometheus

Recently created
Least recently created
Recently updated
Least recently updated

timmy / Flask + Prometheus 快速監控

0 likes
0 forks
1 files
Last active 7 months ago
使用 Flask 和 Prometheus 客戶端,快速設置基本的應用監控,輕鬆追蹤請求數量和延遲。
flask metrics monitoring prometheus python webapp
1 from flask import Flask, Response
2 from prometheus_client import Counter, Summary, generate_latest, CONTENT_TYPE_LATEST
3 import time
4
5 app = Flask(__name__)
6
7 # 自訂 metrics
8 REQUEST_COUNT = Counter('app_requests_total', 'Total number of requests')
9 REQUEST_LATENCY = Summary('app_request_latency_seconds', 'Request latency')
Newer Older

Powered by Opengist ⋅ Load: 19ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文