Class MetricsCdiExtension

All Implemented Interfaces:

public class MetricsCdiExtension extends HelidonRestCdiExtension
MetricsCdiExtension class.

Earlier versions of this class detected app-provided producer fields and methods and triggered creation and registration of the corresponding metrics upon such detection. As explained in this MP metrics issue and this MP metrics PR, this probably was never correct and does not work because @Metric no longer applies to producers per the MP metrics 3.0 spec. The issue and PR discussion explain how developers who provide their own producers should use CDI qualifiers on the producers (and, therefore, injection points) to avoid ambiguity between their own producers and producers written by vendors implementing MP metrics. For Helidon, this means we no longer need to track producer fields and methods, nor do we need to augment injection points with our own VendorProvided qualifier to disambiguate, because we now rely on developers who write their own producers to avoid the ambiguity using qualifiers.

  • Constructor Details

    • MetricsCdiExtension

      public MetricsCdiExtension()
      Creates a new extension instance.
  • Method Details

    • enroll

      public void enroll(MetricAnnotationDiscoveryObserver metricAnnotationDiscoveryObserver)
      Records an observer of metric annotation discoveries.
      metricAnnotationDiscoveryObserver - the observer to enroll
    • enroll

      public void enroll(MetricRegistrationObserver metricRegistrationObserver)
      Records an observer of metric registrations.
      metricRegistrationObserver - the observer to enroll
    • clearAnnotationInfo

      public void clearAnnotationInfo(@Observes AfterDeploymentValidation adv)
      Description copied from class: HelidonRestCdiExtension
      Cleans up any data structures created during annotation processing but which are not needed once the CDI container has started.
      clearAnnotationInfo in class HelidonRestCdiExtension
      adv - the AfterDeploymentValidation event
    • registerService

      public void registerService(@Observes @Priority(1010) @Initialized(jakarta.enterprise.context.ApplicationScoped.class) Object event, BeanManager bm, ServerCdiExtension server)
      Register the Metrics observer with server observer feature. This is a CDI observer method invoked by CDI machinery.
      event - event object
      bm - CDI bean manager
      server - Server CDI extension
    • processManagedBean

      protected void processManagedBean(ProcessManagedBean<?> pmb)
      Description copied from class: HelidonRestCdiExtension
      Deals with a managed bean that survived vetoing, provided by concrete extension implementations.

      The meaning of "process" varies among the concrete implementations. At this point, this base implementation has managed the annotation processing in a general way (e.g., only non-vetoed beans survive) and now delegates to the concrete implementations to actually respond appropriately to the bean and whichever of its members are annotated.

      processManagedBean in class HelidonRestCdiExtension
      pmb - the managed bean, with at least one annotation of interest to the extension
    • componentConfig

      protected Config componentConfig()
      Description copied from class: HelidonRestCdiExtension
      SE Configuration of the current compoennt.
      componentConfig in class HelidonRestCdiExtension
      component configuration