io.vertx.core.spi.metrics

## Interface VertxMetrics

- All Superinterfaces:
    Measured, Metrics

      public interface VertxMetrics
      extends Metrics, Measured

  The main Vert.x metrics SPI which Vert.x will use internally. This interface serves two purposes, one to be called by Vert.x itself for events like verticles deployed, timers created, etc. The other to provide Vert.x with other metrics SPI's which will be used for specific components i.e. `HttpServer`, `EventBusMetrics`, etc.
  Author:
    Nick Scavelli

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `DatagramSocketMetrics` | `createMetrics(DatagramSocket socket, DatagramSocketOptions options)` Provides the datagram/udp metrics SPI when a datagram socket is created.
    `EventBusMetrics` | `createMetrics(EventBus eventBus)` Provides the event bus metrics SPI when the event bus is created.
    `HttpClientMetrics<?,?,?,?,?>` | `createMetrics(HttpClient client, HttpClientOptions options)` Provides the http client metrics SPI when an http client has been created.
    `HttpServerMetrics<?,?,?>` | `createMetrics(HttpServer server, SocketAddress localAddress, HttpServerOptions options)` Provides the http server metrics SPI when an http server is created.
    `TCPMetrics<?>` | `createMetrics(NetClient client, NetClientOptions options)` Provides the net client metrics SPI when a net client is created.
    `TCPMetrics<?>` | `createMetrics(NetServer server, SocketAddress localAddress, NetServerOptions options)` Provides the net server metrics SPI when a net server is created.
    `<P> PoolMetrics<?>` | `createMetrics(P pool, String poolType, String poolName, int maxPoolSize)` Provides the pool metrics SPI.
    `default void` | `eventBusInitialized(EventBus bus)` Metrics cannot use the event bus in their constructor as the event bus is not yet initialized.
    `void` | `timerCreated(long id)` Called when a timer is created
    `void` | `timerEnded(long id, boolean cancelled)` Called when a timer has ended (setTimer) or has been cancelled.
    `void` | `verticleDeployed(Verticle verticle)` Called when a verticle is deployed in Vert.x .
    `void` | `verticleUndeployed(Verticle verticle)` Called when a verticle is undeployed in Vert.x .

    - ### Methods inherited from interface io.vertx.core.spi.metrics.Metrics

      `close, isEnabled`

    - ### Methods inherited from interface io.vertx.core.metrics.Measured

      `isMetricsEnabled`

- - ### Method Detail

    - #### verticleDeployed

          void verticleDeployed(Verticle verticle)

      Called when a verticle is deployed in Vert.x .

      This method is invoked with `Context` and thread of the deployed verticle and therefore might be different on every invocation.

      Parameters:
        `verticle` - the verticle which was deployed

    - #### verticleUndeployed

          void verticleUndeployed(Verticle verticle)

      Called when a verticle is undeployed in Vert.x .

      This method is invoked with `Context` and thread of the deployed verticle and therefore might be different on every invocation, however these are the same than the `verticleDeployed(io.vertx.core.Verticle)` invocation.

      Parameters:
        `verticle` - the verticle which was undeployed

    - #### timerCreated

          void timerCreated(long id)

      Called when a timer is created

      No specific thread and context can be expected when this method is called.

      Parameters:
        `id` - the id of the timer

    - #### timerEnded

          void timerEnded(long id,
                          boolean cancelled)

      Called when a timer has ended (setTimer) or has been cancelled.

      No specific thread and context can be expected when this method is called.

      Parameters:
        `id` - the id of the timer
        `cancelled` - if the timer was cancelled by the user

    - #### createMetrics

          EventBusMetrics createMetrics(EventBus eventBus)

      Provides the event bus metrics SPI when the event bus is created.

      No specific thread and context can be expected when this method is called.

      This method should be called only once.

      Parameters:
        `eventBus` - the Vert.x event bus
      Returns:
        the event bus metrics SPI

    - #### createMetrics

          HttpServerMetrics<?,?,?> createMetrics(HttpServer server,
                                                 SocketAddress localAddress,
                                                 HttpServerOptions options)

      Provides the http server metrics SPI when an http server is created.

      No specific thread and context can be expected when this method is called.

      Note: this method can be called more than one time for the same `localAddress` when a server is scaled, it is the responsibility of the metrics implementation to eventually merge metrics. In this case the provided `server` argument can be used to distinguish the different `HttpServerMetrics` instances.

      Parameters:
        `server` - the Vert.x http server
        `localAddress` - localAddress the local address the net socket is listening on
        `options` - the options used to create the `HttpServer`
      Returns:
        the http server metrics SPI

    - #### createMetrics

          HttpClientMetrics<?,?,?,?,?> createMetrics(HttpClient client,
                                                     HttpClientOptions options)

      Provides the http client metrics SPI when an http client has been created.

      No specific thread and context can be expected when this method is called.

      Parameters:
        `client` - the Vert.x http client
        `options` - the options used to create the `HttpClient`
      Returns:
        the http client metrics SPI

    - #### createMetrics

          TCPMetrics<?> createMetrics(NetServer server,
                                      SocketAddress localAddress,
                                      NetServerOptions options)

      Provides the net server metrics SPI when a net server is created.

      No specific thread and context can be expected when this method is called.

      Note: this method can be called more than one time for the same `localAddress` when a server is scaled, it is the responsibility of the metrics implementation to eventually merge metrics. In this case the provided `server` argument can be used to distinguish the different `TCPMetrics` instances.

      Parameters:
        `server` - the Vert.x net server
        `localAddress` - localAddress the local address the net socket is listening on
        `options` - the options used to create the `NetServer`
      Returns:
        the net server metrics SPI

    - #### createMetrics

          TCPMetrics<?> createMetrics(NetClient client,
                                      NetClientOptions options)

      Provides the net client metrics SPI when a net client is created.

      No specific thread and context can be expected when this method is called.

      Parameters:
        `client` - the Vert.x net client
        `options` - the options used to create the `NetClient`
      Returns:
        the net client metrics SPI

    - #### createMetrics

          DatagramSocketMetrics createMetrics(DatagramSocket socket,
                                              DatagramSocketOptions options)

      Provides the datagram/udp metrics SPI when a datagram socket is created.

      No specific thread and context can be expected when this method is called.

      Parameters:
        `socket` - the Vert.x datagram socket
        `options` - the options used to create the `DatagramSocket`
      Returns:
        the datagram metrics SPI

    - #### eventBusInitialized

          default void eventBusInitialized(EventBus bus)

      Metrics cannot use the event bus in their constructor as the event bus is not yet initialized. When the event bus is initialized, this method is called with the event bus instance as parameter. By default, this method does nothing.
      Parameters:
        `bus` - the event bus

    - #### createMetrics

          <P> PoolMetrics<?> createMetrics(P pool,
                                           String poolType,
                                           String poolName,
                                           int maxPoolSize)

      Provides the pool metrics SPI.
      Parameters:
        `pool` - the pool of resource, it can be used by the metrics implementation to gather extra statistics
        `poolType` - the type of the pool e.g worker, datasource, etc..
        `poolName` - the name of the pool
        `maxPoolSize` - the pool max size, or -1 if the number cannot be determined @return the thread pool metrics SPI

Copyright © 2016. All rights reserved.