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

how to expose EHCache Mbean statistics to datadog from springboot application? #3182

Open
ebett opened this issue Jul 12, 2023 · 0 comments
Open

Comments

@ebett
Copy link

ebett commented Jul 12, 2023

I have a springboot application that runs with datadog agent lib. We can see all app metrics but wanted to see cache statistics in datadog.

I'm using EH-cache 3, I enabled statistics like this example:

 @Bean
  public javax.cache.CacheManager ehCacheManager() {
    
CacheConfiguration<String, String> myCacheConfig = CacheConfigurationBuilder
        .newCacheConfigurationBuilder(String.class, String.class, ResourcePoolsBuilder.heap(10))
        .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofHours(24)))
        .build();

        org.ehcache.config.Configuration configuration = ConfigurationBuilder.newConfigurationBuilder()
        .withCache("myCache", myCacheConfig)
        .build();

    EhcacheCachingProvider provider = (EhcacheCachingProvider) Caching.getCachingProvider(
        "org.ehcache.jsr107.EhcacheCachingProvider");

    javax.cache.CacheManager cacheManager = provider.getCacheManager(
        provider.getDefaultURI(), configuration);

    cacheManager.enableStatistics("myCache", true);
    return cacheManager;
  }

I see statistics metrics from jconsole localy.

Now I need to expose statistics jmx metrics to DataDog. Do I need to add some specific bean? @ljacomet @chrisdennis

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

No branches or pull requests

1 participant