Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Possible Issue #213

Open
safaci2000 opened this issue Feb 1, 2018 · 0 comments
Open

Possible Issue #213

safaci2000 opened this issue Feb 1, 2018 · 0 comments

Comments

@safaci2000
Copy link

I'm trying to create an internal library that contains most of the dependencies that we need for monitoring, basic utilities and configurations that we have for our apps.

My library includes: metrics-spring, metrics-core, and spring-aop.

My app contains my library and spring-aop.

IF I include metrics-spring on a specific app everything works fine.

My configuration is very simple just doing console metrics.

IF I all the required classes are in the App itself everything works fine, but as soon as I pull anything out into a maven library the monitoring is not triggered and the breakpoint on:

private void enableLogReporting(MetricRegistry metricRegistry) { // code } 

Is never triggered in the library version of the configuration.

I hope this is too specialized of a use case, but I don't think I'm doing anything that unusual that it would fail to work.

Have I missed an obvious step in order to use metrics-spring as part of a library?

Current Configuration:

@Configuration
@EnableMetrics
public class TestingConfig extends MetricsConfigurerAdapter {

  @Override
  public void configureReporters(MetricRegistry metricRegistry) {
    MetricRegistry registry = SharedMetricRegistries.add("main", metricRegistry);
    registerReporter(ConsoleReporter
        .forRegistry(metricRegistry)
        .build())
    }

}

Main class config:

@Configuration
@Import({TestingConfig.class})
@ComponentScan(basePackageClasses = {
    AppConfig.class
})
public class AppConfig {

   // more code / beans here
}

The only difference between the two attempts is that the TestingConfig.class is inside my library instead of in my project and that immediate makes my setup non-functional.

Any thoughts?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant