Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide observation context to exporters #18467

Open
npepinpe opened this issue May 13, 2024 · 1 comment
Open

Provide observation context to exporters #18467

npepinpe opened this issue May 13, 2024 · 1 comment
Labels
area/observability Marks an issue as observability related component/zeebe Related to the Zeebe component/team kind/feature Categorizes an issue or PR as a feature, i.e. new behavior

Comments

@npepinpe
Copy link
Member

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

I would like to add metrics from my own custom exporter and have them scraped along with the rest of the Zeebe metrics. However, using the default CollectorRegistry.defaultRegistry (or the Micrometer equivalent one) fails, as the exporter is loaded in a different class loader. This also implies that Zeebe will always rely on the default registry, which may not be true forever.

Describe the solution you'd like

Much like the Context provided to the exporter on configuration has a Logger member, I would like the same for metrics. I think using Micrometer (which is to metrics what SLF4J is to logging) would make more sense, but I'm OK with Prometheus :)

Describe alternatives you've considered

You can work around this by loading the CollectorRegistry class directly from the system class loader, e.g.:

final Class<?> registryClass =
    ClassLoader.getSystemClassLoader().loadClass(CollectorRegistry.class.getName());
final Field registryField = registryClass.getDeclaredField("defaultRegistry");
final CollectorRegistry registry = (CollectorRegistry) registryField.get(null);
Counter.build().name("test").namespace("test").register(registry);

As you can see, this is cumbersome, and ignores all the try-catch and possible errors. It also relies on the defaultRegistry global, which makes it harder if we ever more to Micrometer across the board.

@npepinpe npepinpe added kind/feature Categorizes an issue or PR as a feature, i.e. new behavior area/observability Marks an issue as observability related component/zeebe Related to the Zeebe component/team labels May 13, 2024
@Zelldon
Copy link
Member

Zelldon commented May 17, 2024

Triage:

  • Moving to backlog, as we don't see an urgency for this
  • Please speak up if you think otherwise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/observability Marks an issue as observability related component/zeebe Related to the Zeebe component/team kind/feature Categorizes an issue or PR as a feature, i.e. new behavior
Projects
None yet
Development

No branches or pull requests

2 participants