eiiches / scriptable-jmx-exporter

A javaagent for scraping and exposing MBeans to Prometheus
MIT License
7 stars 2 forks source link

Support multiple comma-separated configurations on -javaagent:exporter.jar= #12

Closed eiiches closed 4 years ago

eiiches commented 4 years ago

We need a way to override .server.bind_address externally to a configuration file. For example, if you have an exporter configuration file baked in docker image, it's hard to override the port number, etc. on runtime. Usually, there's no need to change the port number because each Pod gets its own IP address, however, if you want to run multiple containers on the Pod, they need different port numbers to avoid conflict.

One obvious way to solve this problem is to allow users to override configuration entries by multiple configuration files or JSONs.

-javaagent:scriptable-jmx-exporter-1.0.0.jar=@default.yaml,{"server":{"bind_address":"localhost:19639"}},...
-javaagent:scriptable-jmx-exporter-1.0.0.jar=@default.yaml,@override.yaml,...

We need to come up with a (ideally generic) strategy to merge multiple configuration trees.

eiiches commented 4 years ago

Rules probably need to be merged like this:

Config1.yaml

- pattern: 'A'
  transform: ...
- transform: ... (default A)

Config2.yaml

- pattern: 'B'
  transform: ...
- transform: ... (default B)

Merged.yaml

- pattern: 'A' # from Config1.yaml
  transform: ...
- pattern: 'B' # from Config2.yaml
  transform: ...
- pattern: ... (default B) # from Config2.yaml