0

I have this components that publishes messages to a broker I want to export the same message to prometheus

public class ModuleAMessagePublisher {

    @Inject
    @InternalBroker
    private MessagePublisher messagePublisher;

    public void publish(String topic, final String message) {
        log.info("<><><><><><><><><> (MQ) PUBLISH MODULEA MESSAGE: <><><><><><<>\n", message);
        messagePublisher.publish(topic, message);
// code for prometheus to be added here

    }

}

I'm so new to using prometheus and I'm not sure if it's possible to be done or how can it be done

R0b0t0
  • 390
  • 6
  • 20
  • Prometheus is a "Pull" model, not a "Push" model as far as I know. Usually you tell Prometheus where to go get metrics via HTTP...so maybe what you need is an HTTP server that will respond to a "/metrics" URI with the data you want to give it. – JD Allen Jun 04 '21 at 03:28

1 Answers1

0

You can use the hivemq extention provided to host all the metrics on your hivemq server as described here -

https://www.hivemq.com/extension/prometheus-extension/

This will enable a /metrics endpoint on hivemq server which can be consumed by your prometheus server.

Dev Utkarsh
  • 1,377
  • 2
  • 18
  • 43