All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.marschall.micrometer.jfr.FunctionCounterEventFactory Maven / Gradle / Ivy

package com.github.marschall.micrometer.jfr;

import java.util.List;

import io.micrometer.core.instrument.Meter.Id;
import jdk.jfr.AnnotationElement;
import jdk.jfr.Description;
import jdk.jfr.EventFactory;
import jdk.jfr.Label;
import jdk.jfr.ValueDescriptor;

final class FunctionCounterEventFactory extends AbstractMeterEventFactory {

  FunctionCounterEventFactory(Id id) {
    super(id);
  }

  @Override
  protected List getAdditionalValueDescriptors() {
    List countAnnotations = List.of(
        new AnnotationElement(Label.class, "Count"),
        new AnnotationElement(Description.class, "The cumulative count since this counter was created."));
    ValueDescriptor countDescriptor = new ValueDescriptor(double.class, "count", countAnnotations);

    return List.of(countDescriptor);
  }

  @Override
  JfrFunctionCounterEvent newEmptyEvent(EventFactory eventFactory) {
    return new JfrFunctionCounterEvent(this.id, eventFactory.newEvent());
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy