Push metrics programmatically to Prometheus Pushgateway #1 — TEXT

Maciej
2 min readAug 19, 2021
Push metrics programmatically to Prometheus Pushgateway #1

Introduction

In this post I will show you how to push metrics programmatically to Pushgateway. There are two types of puffed out metrics:

  • Text
  • Protocol buffer

In this post we will cover Protocol buffer

Library for languages

There is a library for each language, although it is a little blind spot because the metric push method to Push gateway is implemented in the client library of Prometheus. Normally, it is better to use the following library.

Prometheus Client Data Specifications

The following documentation describes the format of Prometheus Client Data.

32-Bit Varint-Encoded Record Length-Delimited need to be applied
It seems good to add the Length of the entire byte string of Protocol buffer to the beginning of the byte string.

--

--

Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.