Skip to content

Prometheus Exporter with boost::beast Webserver #2554

Answered by dufferzafar
dufferzafar asked this question in Q&A
Discussion options

You must be logged in to vote

This is what I finally ended up with:

#pragma once

#include <memory>
#include <mutex>
#include <sstream>
#include <string>
#include <vector>

#include <opentelemetry/exporters/prometheus/exporter_utils.h>
#include <opentelemetry/sdk/metrics/metric_reader.h>
#include <prometheus/collectable.h>
#include <prometheus/text_serializer.h>

class PrometheusExporter : public opentelemetry::sdk::metrics::MetricReader
{
public:
    opentelemetry::sdk::metrics::AggregationTemporality GetAggregationTemporality(
        opentelemetry::sdk::metrics::InstrumentType /*instrument_type*/) const noexcept override
    {
        return opentelemetry::sdk::metrics::AggregationTemporality::kCumulative;
    };

…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dufferzafar
Comment options

Answer selected by dufferzafar
Comment options

You must be logged in to vote
1 reply
@mohnishkodnani
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants