Skip to content

lets-mica/mica-prometheus-write

Repository files navigation

mica-prometheus-write

mica-prometheus-write 是一个用于处理 Prometheus 远程写入请求的 Java 实现项目(目前支持写入 kafka)。该项目主要用于接收 Prometheus 的远程写入数据,解码并处理这些数据,可以用于构建 Prometheus 数据的存储后端或转发服务。


🎉🎉🎉推广🎉🎉🎉 BladeX 物联网平台(「mica-mqtt加强版」+「EMQX+Kafka插件」双架构)

✨ 项目特点

  • 支持 Prometheus 远程写入 v1 和 v2 版本协议。
  • 提供基于 Protobuf 的数据结构,用于解析和构建 Prometheus 的写入请求。
  • 提供 HTTP 接口处理 Prometheus 的远程写入请求。
  • 包含 Snappy 压缩解压工具,支持解压远程写入数据。
  • 提供详细的 MetricMetadata、TimeSeries、Sample
  • 支持扩展,可轻松集成到其他存储系统或数据转发服务中。

🏗 安装

项目使用 Maven 构建,可以直接通过以下命令进行构建:

mvn clean package

然后直接运行 java -jar mica-prometheus-write-server.jar 即可,配置支持 jar 同级目录 config.propertiesconfig/config.properties,也支持环境变量。

config.properties 配置示例详见:config.properties

🔧 配置(prometheus.yml)

# 开启远程写出
remote_write:
    - url: "http://127.0.0.1:8080/write"
#      protobuf_message: io.prometheus.write.v2.Request # 开启 v2 版,消息更加紧凑,默认:prometheus.WriteRequest v1版
#      basic_auth:  # 开启基础认证
#          username: xxxxxx
#          password: xxxxxx
#      write_relabel_configs:
#        # 必须列出所有需要传输的指标名
#        - source_labels: [__name__]
#          regex: "kafka_topic_partition_current_offset|kafka_topic_partitions"
#          action: keep

注意:更多配置请查看:https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write

🎨 效果展示

kafka

🍻 我的开源

About

用于接收 prometheus write 发送的数据,方便自行转发到 kafka、时序数据库。

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages