Skip to content

Queries prometheus query and metadata endpoints and selectively exposes the metrics scrapped by prometheus endpoint.

Notifications You must be signed in to change notification settings

milind12/metrics_exporter

Repository files navigation

Metrics Exporter

License

Overview

Metrics Exporter is a Go library that provides functionality to interact with Prometheus endpoints and exposes metrics in the text-based exposition format. It simplifies the process of collecting and selectively exposing metrics for monitoring purposes. For example, if there is an usecase of exposing subset of metrics, prometheus metrics exporter enables us to filter the metrics using prometheus query endpoint, and exposes the metrics in text based exposition format.

Features

  • Seamless integration with Prometheus endpoints
  • Automatic exposition of metrics in the text-based format

Installation

To install metrics_exporter, use the following command:

go get -u github.com/milind12/metrics_exporter

Getting Started

To get started with this project, follow these steps:

1 . Import the package into your Go code:

import "github.com/milind12/metrics_exporter"
  1. Following code example demonstrates selectively exposing metrics which have label job with value demo-app-metrics
promExporterInstance, err := NewPrometheusExporterInstance("http", "<PrometheusHost>", "<PrometheusPort>", []map[string]string{map[string]string{"job": "demo-app-metrics"}})
if err != nil {
    t.Errorf("failed")
}
exportedMetrics:= promInstance.ExportMetrics()
fmt.Println(exportedMetrics)

About

Queries prometheus query and metadata endpoints and selectively exposes the metrics scrapped by prometheus endpoint.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages