hivemq / helm-charts

HiveMQ Helm charts
http://hivemq.github.io/helm-charts
Apache License 2.0
25 stars 18 forks source link

hivemq-platform-operator: issue with enabling prometheus extension #393

Open ArtemZ opened 5 days ago

ArtemZ commented 5 days ago

Hello,

I use the recent hivemq-platform-operator and hivemq-platform charts. I wanted to enabled prometheus metrics for hivemq and therefore tried to enable the related extension in plaform chart:

extensions:
  - name: hivemq-prometheus-extension
    enabled: true

but after that, I'm getting the following error in hivemq-platform-operator:

04:01:44.936 [pool-13-thread-24] WARN  c.h.p.o.d.StatefulSetResource - [hivemq4] Cannot reconcile the StatefulSet: The custom resource spec is invalid
java.lang.IllegalArgumentException: The extension 'hivemq-prometheus-extension' is fully managed by the HiveMQ Platform Operator and cannot be customized via an extension configuration
    at com.hivemq.platform.operator.v1.HiveMQPlatformValidator.lambda$validateExtensions$4(HiveMQPlatformValidator.java:246)
    at java.base/java.util.ArrayList.forEach(Unknown Source)
    at com.hivemq.platform.operator.v1.HiveMQPlatformValidator.validateExtensions(HiveMQPlatformValidator.java:238)
    at com.hivemq.platform.operator.v1.HiveMQPlatformValidator.validateSpec(HiveMQPlatformValidator.java:92)
    at com.hivemq.platform.operator.dependants.StatefulSetResource.reconcile(StatefulSetResource.java:108)
    at com.hivemq.platform.operator.dependants.StatefulSetResource.reconcile(StatefulSetResource.java:55)
    at io.javaoperatorsdk.operator.processing.dependent.workflow.WorkflowReconcileExecutor$NodeReconcileExecutor.doRun(WorkflowReconcileExecutor.java:123)
    at io.javaoperatorsdk.operator.processing.dependent.workflow.NodeExecutor.run(NodeExecutor.java:22)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

I also set this configuraion for the platform chart:

# Monitoring settings used by the HiveMQ Prometheus extension.
metrics:
  # Set to disable or enable the HiveMQ Prometheus extension.
  enabled: true
  # Defines the port to be used by the HiveMQ Prometheus extension.
  port: 9399
  # Defines the URL path to be used by HiveMQ Prometheus extension.
  path: /

but it made no effect.

So how do I get metrics then? I looked up in /opt/hivemq/extensions/hivemq-prometheus-extension on the pod and there is "DISABLED" file in this folder, so the init script skips this extension. How to properly enable it then?

afalhambra-hivemq commented 5 days ago

Hello @ArtemZ! Thanks for reaching out.

As you can see from the error log, the HiveMQ Prometheus extension is already bundled with the HiveMQ Platform Operator

The extension 'hivemq-prometheus-extension' is fully managed by the HiveMQ Platform Operator and cannot be customized via an extension configuration

Out of the box, when installing the HiveMQ Platform you will automatically get a a metrics Kubernetes service available, so you don't really need to do anything else to setup the Prometheus extension to get the HiveMQ metrics.

Of course, you can still configure it by using some of the Helm HiveMQ Platform chart values for the same as documented here: https://docs.hivemq.com/hivemq-platform-operator/configuration.html#metrics-options

Hope it helps.