Java Code Examples for org.eclipse.microprofile.metrics.MetricUnits#NONE

The following examples show how to use org.eclipse.microprofile.metrics.MetricUnits#NONE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BookStoreEndpoint.java    From ebook-Building-an-API-Backend-with-MicroProfile with Apache License 2.0 5 votes vote down vote up
@Counted(unit = MetricUnits.NONE,
        name = "getBook",
        absolute = true,
        monotonic = true,
        displayName = "get single book",
        description = "Monitor how many times getBook method was called")
@GET
@Path("{id}")
public Response getBook(@PathParam("id") Long id) {
    Book book = bookService.findById(id);

    return Response.ok(book).build();
}
 
Example 2
Source File: MultipleMetricsMethodBean.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@Counted(name = "counter")
@Gauge(name = "gauge", unit = MetricUnits.NONE)
@Metered(name = "meter")
@Timed(name = "timer")
public Long metricsMethod() {
    return 1234L;
}
 
Example 3
Source File: Summary.java    From trader with Apache License 2.0 4 votes vote down vote up
@Gauge(name="portfolio_loyalty", tags="level=unknown", displayName="Unknown", unit=MetricUnits.NONE)
public int getUnknown() {
	return unknown;
}
 
Example 4
Source File: GaugeTagMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@Gauge(name = "gaugeMethod", unit=MetricUnits.NONE, tags = {"number=one"})
public long getGaugeOne() {
    return gaugeOne;
}
 
Example 5
Source File: GaugeMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@Gauge(name = "gaugeMethod", unit=MetricUnits.NONE)
public long getGauge() {
    return gauge;
}
 
Example 6
Source File: MetricAppBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@org.eclipse.microprofile.metrics.annotation.Gauge(name = TAGGED_GAUGE,
        absolute = true,unit = MetricUnits.NONE, tags= {"number=two"})
public long gaugeMeTaggedTwo() {
    return 1000L;
}
 
Example 7
Source File: InheritedParentGaugeMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@Gauge(name = "inheritedParentGaugeMethod", unit=MetricUnits.NONE)
public long getGauge() {
    return gauge;
}
 
Example 8
Source File: MetricAppBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@org.eclipse.microprofile.metrics.annotation.Gauge(name = TAGGED_GAUGE,
        absolute = true,unit = MetricUnits.NONE)
public long gaugeMeTagged() {
    return 1000L;
}
 
Example 9
Source File: MetricsResource.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@GET
@Path("/gauge")
@Gauge(name = "gauge", unit = MetricUnits.NONE)
public Long gauge() {
    return 42L;
}
 
Example 10
Source File: GaugeTagMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@Gauge(name = "gaugeMethod", unit=MetricUnits.NONE, tags = {"number=two"})
public long getGaugeTwo() {
    return gaugeTwo;
}
 
Example 11
Source File: Summary.java    From trader with Apache License 2.0 4 votes vote down vote up
@Gauge(name="portfolio_loyalty", tags="level=platinum", displayName="Platinum", unit=MetricUnits.NONE)
public int getPlatinum() {
	return platinum;
}
 
Example 12
Source File: OrderEndpoint.java    From Hands-On-Cloud-Native-Applications-with-Java-and-Quarkus with MIT License 4 votes vote down vote up
@Gauge(name = "peakOfOrders", unit = MetricUnits.NONE, description = "Highest number of orders")
public Long highestNumberOfOrders() {
    return orderRepository.countAll();
}
 
Example 13
Source File: OpenMetricsUnit.java    From smallrye-metrics with Apache License 2.0 4 votes vote down vote up
/**
 * Determines the basic unit to be used by OpenMetrics exporter based on the input unit from parameter.
 * That is:
 * - for memory size units, returns "bytes"
 * - for time units, returns "seconds"
 * - for any other unit, returns the input unit itself
 */
public static String getBaseUnitAsOpenMetricsString(Optional<String> optUnit) {

    if (!optUnit.isPresent()) {
        return MetricUnits.NONE;
    }

    String unit = optUnit.get();

    String out;
    switch (unit) {

        /* Represents bits. Not defined by SI, but by IEC 60027 */
        case MetricUnits.BITS:
            /* 1000 {@link #BITS} */
        case MetricUnits.KILOBITS:
            /* 1000 {@link #KIBIBITS} */
        case MetricUnits.MEGABITS:
            /* 1000 {@link #MEGABITS} */
        case MetricUnits.GIGABITS:
            /* 1024 {@link #BITS} */
        case MetricUnits.KIBIBITS:
            /* 1024 {@link #KIBIBITS} */
        case MetricUnits.MEBIBITS:
            /* 1024 {@link #MEBIBITS} */
        case MetricUnits.GIBIBITS:
            /* 8 {@link #BITS} */
        case MetricUnits.BYTES:
            /* 1000 {@link #BYTES} */
        case MetricUnits.KILOBYTES:
            /* 1000 {@link #KILOBYTES} */
        case MetricUnits.MEGABYTES:
            /* 1000 {@link #MEGABYTES} */
        case MetricUnits.GIGABYTES:
            out = "bytes";
            break;

        /* 1/1000 {@link #MICROSECONDS} */
        case MetricUnits.NANOSECONDS:
            /* 1/1000 {@link #MILLISECONDS} */
        case MetricUnits.MICROSECONDS:
            /* 1/1000 {@link #SECONDS} */
        case MetricUnits.MILLISECONDS:
            /* Represents seconds */
        case MetricUnits.SECONDS:
            /* 60 {@link #SECONDS} */
        case MetricUnits.MINUTES:
            /* 60 {@link #MINUTES} */
        case MetricUnits.HOURS:
            /* 24 {@link #HOURS} */
        case MetricUnits.DAYS:
            out = "seconds";
            break;
        default:
            out = unit;
    }
    return out;
}
 
Example 14
Source File: Initialization_Gauge_Method_Test.java    From smallrye-metrics with Apache License 2.0 4 votes vote down vote up
@Gauge(name = "gaugeApp", absolute = true, unit = MetricUnits.NONE)
public Long gauge() {
    return ++i;
}
 
Example 15
Source File: Summary.java    From trader with Apache License 2.0 4 votes vote down vote up
@Gauge(name="portfolio_loyalty", tags="level=gold", displayName="Gold", unit=MetricUnits.NONE)
public int getGold() {
	return gold;
}
 
Example 16
Source File: InventoryManager.java    From boost with Eclipse Public License 1.0 4 votes vote down vote up
@Gauge(unit = MetricUnits.NONE, name = "inventorySizeGuage", absolute = true, description = "Number of systems in the inventory")
public int getTotal() {
    return systems.size();
}
 
Example 17
Source File: InventoryManager.java    From boost with Eclipse Public License 1.0 4 votes vote down vote up
@Gauge(unit = MetricUnits.NONE, name = "inventorySizeGuage", absolute = true, description = "Number of systems in the inventory")
public int getTotal() {
    return systems.size();
}
 
Example 18
Source File: TodoResource.java    From quarkus-deep-dive with Apache License 2.0 4 votes vote down vote up
@Gauge(name = "numberOfItems", unit = MetricUnits.NONE,
        description = "Number of todo list items.")
public long count() {
    return Todo.findCompleted().size();
}
 
Example 19
Source File: RestHandler.java    From Hands-On-Enterprise-Java-Microservices-with-Eclipse-MicroProfile with MIT License 4 votes vote down vote up
@SuppressWarnings("unused")
@Gauge(name = "aGauge", unit = MetricUnits.NONE)
int myGauge() {
  return 42;
}
 
Example 20
Source File: MetricController.java    From Hands-On-Enterprise-Java-Microservices-with-Eclipse-MicroProfile with MIT License 4 votes vote down vote up
@Gauge(name = "counter_gauge", unit = MetricUnits.NONE)
private long getCustomerCount() {
    return counter.getCount();
}