open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.95k stars 2.29k forks source link

jmx receiver autodiscover targets in kubernetes? #32965

Closed ceastman-r7 closed 2 months ago

ceastman-r7 commented 4 months ago

Component(s)

receiver/jmx

Is your feature request related to a problem? Please describe.

The problem is that the endpoint has to be hardcoded: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/jmxreceiver#endpoint

datadog's jmx can autodiscovery: https://docs.datadoghq.com/containers/guide/autodiscovery-with-jmx/?tab=operator

Describe the solution you'd like

Some mechanism for autodiscovery of jmx endpoints for kubernetes.

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 4 months ago

Pinging code owners:

github-actions[bot] commented 2 months ago

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

hughesjj commented 2 months ago

Hey, this seems like a dupe of 31599, could I mark it as such?

TL;dr is that there are extensions/observers that can, in conjunction with receivercreator, dynamically add jmx, but there are some caveats

@ datadog, it seems they have you specify a port for autodiscovery

Set as desired, as long as it matches between the annotations and JAVA_OPTS

in the context of the docker observer/receiver_creator, you would specify port == JMXPORT in the rules, similar to the redis example

      redis/1:
        # If this rule matches an instance of this receiver will be started.
        rule: type == "port" && port == 6379
        config:
          # Static receiver-specific config.
          password: secret
          # Dynamic configuration value.
          collection_interval: '`pod.annotations["collection_interval"]`'
ceastman-r7 commented 2 months ago

@hughesjj feel free to mark this as a duplicate. I am going to close this issue.