vertx / io.vertx.core.spi.metrics / VertxMetrics / createMetrics

# createMetrics

`abstract fun createMetrics(eventBus: EventBus): EventBusMetrics<Any>`

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

Return
the event bus metrics SPI or `null` when metrics are disabled

`abstract fun createMetrics(server: HttpServer, localAddress: SocketAddress, options: HttpServerOptions): HttpServerMetrics<*, *, *>`

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 io.vertx.core.http.HttpServer

Return
the http server metrics SPI or `null` when metrics are disabled

`abstract fun createMetrics(client: HttpClient, options: HttpClientOptions): HttpClientMetrics<*, *, *, *, *>`

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 io.vertx.core.http.HttpClient

Return
the http client metrics SPI or `null` when metrics are disabled

`abstract fun createMetrics(localAddress: SocketAddress, options: NetServerOptions): TCPMetrics<*>`

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

`localAddress` - localAddress the local address the net socket is listening on

`options` - the options used to create the NetServer

Return
the net server metrics SPI or `null` when metrics are disabled

`abstract fun createMetrics(options: NetClientOptions): TCPMetrics<*>`

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

`options` - the options used to create the NetClient

Return
the net client metrics SPI or `null` when metrics are disabled

`abstract fun createMetrics(socket: DatagramSocket, options: DatagramSocketOptions): DatagramSocketMetrics`

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 io.vertx.core.datagram.DatagramSocket

Return
the datagram metrics SPI or `null` when metrics are disabled

`abstract fun <P : Any> createMetrics(pool: P, poolType: String, poolName: String, maxPoolSize: Int): PoolMetrics<*>`

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 or `null` when metrics are disabled