Skip to content

Conversation

vpelikh
Copy link
Contributor

@vpelikh vpelikh commented Oct 9, 2025

It's useful to see metrics in the console during development, without having to set up an LGTM container or write additional code.

Signed-off-by: Vasily Pelikh <2010720+vasilypelikh@users.noreply.github.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 9, 2025
@jonatan-ivanov
Copy link
Member

It might make sense to add auto-configuration for LoggingMeterRegistry but I feel your original problem statement:

It's useful to see metrics in the console during development, without having to set up an LGTM container or write additional code.

might be easier to resolve using the /actuator/metrics or the /actuator/prometheus endpoints. LoggingMeterRegistry is not on-demand, it's a "step" registry, you need to wait for the logs to be emitted (once per minute by default). Also, Boot registers quite a few metrics, finding them in the logs might not be that easy as using the actuator endpoints above.

@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label Oct 9, 2025
Copy link

@danish-ali danish-ali left a comment

Choose a reason for hiding this comment

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

You verify back-off when a Clock is absent, but not when LoggingMeterRegistry itself is missing.
Could we add an ApplicationContextRunner test with a FilteredClassLoader(LoggingMeterRegistry.class) to assert that neither LoggingMeterRegistry nor LoggingRegistryConfig is created? That would complement the @ConditionalOnClass(LoggingMeterRegistry.class) path.

Additionally, minor naming nit in LoggingMetricsExportPropertiesConfigAdapterTests: some methods refer to “AggregationTemporality” but assert logInactive(). Consider renaming to reflect logInactive to avoid confusion.

@vpelikh
Copy link
Contributor Author

vpelikh commented Oct 11, 2025

might be easier to resolve using the /actuator/metrics or the /actuator/prometheus endpoints.

Good suggestion. But if I remember correctly, these endpoints only shows the latest values. In this case, one of the purposes of metrics - comparing values ​​at different times during the application's execution - is lost.

LoggingMeterRegistry is not on-demand, it's a "step" registry, you need to wait for the logs to be emitted (once per minute by default).

Yep, and I think this behavior what you should expect from a metrics system - to show metric values once in a while. 😀

Also, Boot registers quite a few metrics, finding them in the logs might not be that easy as using the actuator endpoints above.

Honestly, I never had this problem. But surely new configuration options can be added in future.

It might make sense to add auto-configuration for LoggingMeterRegistry

You mean use logging registry instead of simple if other options are not suitable?
I've considered this, but decided not to change the current behavior, because what's in this MR is sufficient for my purposes. Now, thinking about it, I see the benefit of always seeing metrics by default, even if only in logs, rather than the otlp sender's error. It seems like a spring boot way.
But it is still debatable, so I guess it will be better to open another MR with this changes.

@vpelikh
Copy link
Contributor Author

vpelikh commented Oct 11, 2025

Oh, thanks for the review, @danish-ali! I will check it out later when I will be around pc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

for: team-meeting An issue we'd like to discuss as a team to make progress status: waiting-for-triage An issue we've not yet triaged

5 participants