This message was deleted.
# general
s
This message was deleted.
d
Instrumenting jvm apps with pulsar producer / consumer works beautifully/easy for me, but i am confused as to how to attach the agent to a function..
a
I suppose the java runtime of the function does not include the otel agent. Do you include the agent somehow in your functions jar?
d
I have added the agent to the (stand-alone) broker, and set
additionalJavaRuntimeArguments
to that path. I also tried that for
custom-runtime-options
. (So even a strong steer on whether i should pursue using
custom-runtime-options
or
additionalJavaRuntimeArguments
would really help me at this point. When I read their descriptions it seems to me that both could work)
a
What functions runtime are you using? (
kubernetes/thread/process
)
d
Process
👀 1
Just in a local dev env currently, but it seems that
localrun
would not work (with
additionalJavaRuntimeArguments
at least)
a
Yeah
localrun
won’t work. In theory your setup looks fine to me, maybe you can check the path to the agent jar again? If not, maybe @Neng knows why the function runtime cannot access the agent jar
d
As you can see from my screen shot also, i am setting other additionalJavaRuntimeArguments in the _*conf/functions_worker.yml*_ (mostly to help debug / figure out what is working). I dont see any of these printed in my pulsar function. I am doing this:
val runtimeMxBean = ManagementFactory.getRuntimeMXBean()
val arguments = runtimeMxBean._inputArguments_
<http://context._logger_.info|context._logger_.info>("arguments $arguments ${arguments.size}")
, and just the output:
[-Dpulsar.functions.extra.dependencies.dir=/pulsar/instances/deps, -Dpulsar.functions.instance.classpath=/pulsar/conf:::/pulsar/lib/*:, -Dlog4j.configurationFile=/pulsar/conf/functions_log4j2.xml, -Dpulsar.function.log.dir=logs//functions/public/default/new-message-functionXXXxXXzXxxcq, -Dpulsar.function.log.file=new-message-functionXXXxXXzXxxcq-0, -Xmx1073741824]
Either; 1. my assumption that
runtimeMxBean
would print
conf/functions_worker.yml
conf/functions_worker.yml
values is wrong 2. I ams setting the
additionalJavaRuntimeArguments
incorrectly 3. ?
n
which pulsar version are you using?
also, can you try the
ps
cmd to check the function process start cmd? You should be able to see the complete cmd for starting your function. In my exmaple below,
-XX:+ExitOnOutOfMemoryError
is in the java process start cmd
Copy code
-> ps aux | grep Instance

nlu              23124   5.6  0.8 412421264 260768 s016  S+   10:19AM   0:03.05 /usr/bin/java -cp /Users/nlu/work/projects/apache-pulsar-2.11.0/instances/java-instance.jar:/Users/nlu/work/projects/apache-pulsar-2.11.0/instances/deps/* -Dpulsar.functions.extra.dependencies.dir=/Users/nlu/work/projects/apache-pulsar-2.11.0/instances/deps -Dpulsar.functions.instance.classpath=/Users/nlu/work/projects/apache-pulsar-2.11.0/conf:::/Users/nlu/work/projects/apache-pulsar-2.11.0/lib/*: -Dlog4j.configurationFile=/Users/nlu/work/projects/apache-pulsar-2.11.0/conf/functions_log4j2.xml -Dpulsar.function.log.dir=logs//functions/public/default/LoggingTest -Dpulsar.function.log.file=LoggingTest-0 -Dio.netty.tryReflectionSetAccessible=true --add-opens java.base/sun.net=ALL-UNNAMED -XX:+ExitOnOutOfMemoryError -Xmx1073741824 org.apache.pulsar.functions.instance.JavaInstanceMain --jar /Users/nlu/work/projects/apache-pulsar-2.11.0/download/pulsar_functions/public/default/LoggingTest/0/api-examples.jar --instance_id 0 --function_id e86ae945-139a-432e-ad0b-635d83517333 --function_version 5332f091-7966-41ee-ab70-74da5c85a821 --function_details '{"tenant":"public","namespace":"default","name":"LoggingTest","className":"org.apache.pulsar.functions.api.examples.LoggingFunction","autoAck":true,"parallelism":1,"source":{"typeClassName":"java.lang.String","inputSpecs":{"public/default/test":{}},"cleanupSubscription":true},"sink":{"topic":"public/default/test-output","typeClassName":"java.lang.String","forwardSourceMessageProperty":true},"resources":{"cpu":1.0,"ram":"1073741824","disk":"10737418240"},"componentType":"FUNCTION"}' --pulsar_serviceurl <pulsar://localhost:6650> --max_buffered_tuples 1024 --port 59065 --metrics_port 59066 --pending_async_requests 1000 --expected_healthcheck_interval 30 --secrets_provider org.apache.pulsar.functions.secretsprovider.ClearTextSecretsProvider --cluster_name standalone --nar_extraction_directory /var/folders/yg/wbs3btdd69g60q0nqlw6x7r80000gn/T/
d
Thanks
version Pulsar 2.8.4
n
it’s too old and doesn’t contain the
additionalArg
fix
please use 2.10.0 and later..
d
Ah ok, thanks. Ill report back how i get on
👌 1
It works 🙌 Thanks for the help guys, really appreciate it. I will circle back to me S/O question so others can have some info on this.
👍 4