Hi Neil,

I haven't personally tried. But since kafka-native contains not really a Java 
application, but a GraalVM-compiled native application, it doesn't support Java 
agents.

Best,
Ivan


On Thu, Aug 8, 2024, at 22:36, Neil Buesing wrote:
> I am attempt to set javaagents for the kafka-native image (like I have done
> with the confluent kafka images)
> 
> However, the following:
> 
> KAFKA_OPTS:
> -javaagent:/opt/jmx_prometheus/jmx_prometheus_javaagent.jar=7071:/opt/jmx_prometheus/kafka-config.yml
> -javaagent:/opt/jmx_prometheus/jolokia-jvm.jar=port=7072,host=*
> 
> results in
> 
> ksd-controller-0  | usage: kafka-docker-wrapper start [-h] --config CONFIG
> ksd-controller-0  | kafka-docker-wrapper:   error:    unrecognized
> arguments:   '-javaagent:
> ksd-controller-0  | /opt/jmx_prometheus/jmx_prometheus_javaagent.jar=7071:
> ksd-controller-0  | /opt/jmx_prometheus/kafka-config.yml'
> 
> in looking at the code, $KAFKA_OPTS is at the end of the script, but
> `-javaagent` must appear before any -jar operand.
> 
> I believe this was changed as a result of the native image start
> `/opt/kafka/kafka.Kafka`, so I have tried to look at the /docker folder
> within the repository to see if there is a different environment variable
> that would work instead, but no luck.
> 
> I have tried JAVA_TOOLS_OPTIONS and _JAVA_OPTIONS hoping there was a way to
> get the global variables (that I know of) to work -- but again, no luck.
> 
> Thanks,
> 
> Neil
> 

Reply via email to