如何将普罗米修斯度量直接推广到维多利亚度量?

2024-06-06 11:03:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用python prometheus客户端,在将度量值推送到VictoriaMetrics(VM)时遇到问题

有一个名为push_to_gateway的函数,我试图用VM:http://prometheus:9091 -> http://vm:8428/api/v1/write替换prometheus URL。但VM以400状态代码响应


Tags: to函数apihttp客户端度量vmpush
3条回答

另外,请看一下我最近创建的客户端:https://github.com/gistart/prometheus-push-client

supports pushes directly to VictoriaMetrics via UDP and HTTP using InfluxDB line protocol

to StatsD or statsd-exporter in StatsD format via UDP

to pushgateway or prom-aggregation-gateway in OpenMetrics format via HTTP

可以将push_to_gateway方法用于维多利亚式测量,请参见gisthttps://gist.github.com/f41gh7/85b2eb895bb63b93ce46ef73448c62d0中的示例

我在/api/v1/import/csv使用CSV导入,如下所述:https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/README.md#how-to-import-csv-data

直接从数据帧生成CSV。比如:

    df.rename(columns={'timestamp': 'ts_ns'}, inplace=True)
    data = df.to_csv(index=False, header=False)

    csv_format = f'1:time:unix_ns{metric_format}{label_format}'

    response = requests.post(url, params={'format': csv_format}, data=data)

相关问题 更多 >