中级
生成Prometheus格式指标
未完成
中级参考
代码结构已给出,请填写 ____ 处
def solve():
from pyodide.http import open_url
from io import StringIO
import pandas as pd
metrics_csv = open_url(____).read()
metrics = pd.read_csv(StringIO(____))
lines = []
lines.append(____)
lines.append(____)
for _, row in metrics.iterrows():
dtype = str(____) if str(____) not in (____) else '____'
lines.append('____' + row['____'] + '____' + dtype + '____' + str(____))
lines.append(____)
lines.append(____)
for _, row in metrics.iterrows():
dtype = str(____) if str(____) not in (____) else '____'
lines.append('____' + row['____'] + '____' + dtype + '____' + str(____))
for line in lines[:____]:
print(____)
print(____)
示例
输入
solve()
期望输出
# HELP iot_upload_total Total device uploads
# TYPE iot_upload_total counter
iot_upload_total{service="data-ingestion",device_type="temperature"} 150
iot_upload_total{service="data-ingestion",device_type="vibration"} 80
iot_upload_total{service="data-ingestion",device_type="pressure"} 60
iot_upload_total{service="alert-engine",device_type="all"} 30
# HELP iot_p99_latency_ms P99 latency in ms
# TYPE iot_p99_latency_ms gauge
iot_p99_latency_ms{service="data-ingestion",device_type="temperature"} 250
iot_p99_latency_ms{service="data-ingestion",device_type="vibration"} 280
iot_p99_latency_ms{service="data-ingestion",device_type="pressure"} 850
iot_p99_latency_ms{service="alert-engine",device_type="all"} 400
... (total 12 metric lines)
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199