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

ARTEMIS-4655 report logging metrics #4830

Merged
merged 1 commit into from
Mar 5, 2024
Merged

Conversation

jbertram
Copy link
Contributor

It may be useful to configure alerts for ERROR or WARN events in the log which may go unnoticed otherwise.

Comment on lines +90 to +92
if (metricsConfiguration.isLogging()) {
new Log4j2Metrics().bindTo(meterRegistry);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the broker as a whole is not really tied to Log4j2 (but rather SLF4J API), it actually feels a little weird that this is. Especially as the broker (or micrometer) has no [passed-on] dependency on Log4J2, so this wont work in some cases. The config doc should perhaps be clearer that it is Log4j2-specific, and perhaps note that such a dependency would need to be provided if enabling this while e.g embedding / not using the distribution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the docs to clarify this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure the new doc is clear enough / goes far enough. This thing actually depends on Log4J API and Log4J Core, but neither the broker (no dep at all) or micrometer core (optional dep) have a hard dep on them to bring them in...so for anyone e.g embedding, it seems likely to blow up at this point unless some other dep has actually brought in log4j-core. Our tests happen to do that and so wont show any issue.

https://github.com/micrometer-metrics/micrometer/blob/v1.12.2/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/logging/Log4j2Metrics.java

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the latest update.

@jbertram jbertram force-pushed the ARTEMIS-4655 branch 2 times, most recently from 21a2740 to 1e5f31f Compare February 29, 2024 04:37
Comment on lines +90 to +92
if (metricsConfiguration.isLogging()) {
new Log4j2Metrics().bindTo(meterRegistry);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure the new doc is clear enough / goes far enough. This thing actually depends on Log4J API and Log4J Core, but neither the broker (no dep at all) or micrometer core (optional dep) have a hard dep on them to bring them in...so for anyone e.g embedding, it seems likely to blow up at this point unless some other dep has actually brought in log4j-core. Our tests happen to do that and so wont show any issue.

https://github.com/micrometer-metrics/micrometer/blob/v1.12.2/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/logging/Log4j2Metrics.java

@jbertram jbertram force-pushed the ARTEMIS-4655 branch 3 times, most recently from 61cb2d4 to 1269a58 Compare March 1, 2024 03:06
@gemmellr
Copy link
Member

gemmellr commented Mar 4, 2024

I ran the full test suite job on this and it failed at the new test. I pulled and rebased your changes locally and tried the test in isolation, and it also failed in the same way. Seems that something is needing tweaked.

It may be useful to configure alerts for ERROR or WARN events in the log
which may go unnoticed otherwise.
@jbertram
Copy link
Contributor Author

jbertram commented Mar 4, 2024

The test was working originally. I'm not sure how I broke it, but it's working again now.

@gemmellr gemmellr merged commit 661a4e6 into apache:main Mar 5, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants