Self-Managed Mongo Source Connector JMX Metrics

Hi all,

I have a dockerized deployment of a self-managed Mongo Source Apache Kafka Connector. I am hoping to enable JMX metrics insights to gain visibility into this connector’s performance.

I’ve followed guidelines posted online and set an environment variable KAFKA_JMX_PORT to 9999. I see logs indicating that the JMX configs are set appropriately:
[2024-05-02 19:46:28,239] INFO WorkerInfo values: jvm.args = -Xmx2G, -Xms2G, -XX:+UseG1GC, -XX:MaxGCPauseMillis=20, -XX:InitiatingHeapOccupancyPercent=35, -XX:+ExplicitGCInvokesConcurrent, -XX:MaxInlineLevel=15, -Djava.awt.headless=true, -Dcom.sun.management.jmxremote=true, -Dcom.sun.management.jmxremote.authenticate=false, -Dcom.sun.management.jmxremote.ssl=false, -Djava.rmi.server.hostname=172.17.0.2, -Dcom.sun.management.jmxremote.local.only=false, -Dcom.sun.management.jmxremote.rmi.port=9999, -Dcom.sun.management.jmxremote.port=9999, -Dcom.sun.management.jmxremote.port=9999, -Dkafka.logs.dir=/var/log/kafka, -Dlog4j.configuration=file:/etc/kafka/connect-log4j.properties, -Djavax.net.ssl.trustStore=/opt/kafka/config/jssecacerts

I don’t see any logs indicating that the JMX metrics have been made available and instead see the following:
[2024-05-02 20:15:44,205] INFO Metrics scheduler closed (org.apache.kafka.common.metrics.Metrics) [2024-05-02 20:15:44,205] INFO Closing reporter org.apache.kafka.common.metrics.JmxReporter (org.apache.kafka.common.metrics.Metrics) [2024-05-02 20:15:44,205] INFO Metrics reporters closed (org.apache.kafka.common.metrics.Metrics)

I’ve attempted to set the KAFKA_JMX_HOSTNAME property to localhost as well as explicitly set the CONFLUENT_METRIC_REPORTERS to the default JmxReporter package to no avail.

I’ve exec’d into the Docker container to run curl requests on the specified port curl http://localhost:9999 with the following response:
curl: (52) Empty reply from server

However, curl http://localhost:8083 gives me a proper response.

Could someone please aid me in what I may be missing to configure/setup JMX metrics appropriately?