Skip to content

Record cache.size in CaffeineCacheMetrics without enabling recordStats() #6128

@psemeniuk

Description

@psemeniuk

Describe the bug
This warning
in Caffeine cache metrics is misleading as "except 'cache.size'" phrase is simply not true (i mean that cache.size also isn't registered). Resolving size uses the same getOrDefault method as the rest of the metrics. This method resolves to null when recording is disabled.

Environment
I see that bug in the newest source code.

To Reproduce

  1. Create cache with unique name without enabling stats recording.
  2. Bind cache to MeterRegistry
  3. Observe that no cache.size metric is sent for typed cache name.

Expected behavior
Warn log shouldn't be misleading or if possible caffeine cache implementation should register cache.size metric even without stats recording being enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA general buginstrumentationAn issue that is related to instrumenting a componentmodule: micrometer-coreAn issue that is related to our core module

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions