# Class IdMetricsService

java.lang.Object
com.io7m.idstore.server.service.telemetry.api.IdMetricsService

All Implemented Interfaces:
  `IdMetricsServiceType, com.io7m.repetoir.core.RPServiceType, AutoCloseable`

public final class IdMetricsService extends Object implements IdMetricsServiceType
The metrics service.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IdMetricsService(IdServerTelemetryServiceType telemetry)`
  The metrics service.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `String`
  `description()`
  `void`
  `onClosedForMaintenance(boolean closed)`
  The server is open for business, or closed for maintenance.
  `void`
  `onHttp2xx(IdUserDomain type)`
  An HTTP request resulted in a 2xx success.
  `void`
  `onHttp4xx(IdUserDomain type)`
  An HTTP request resulted in a 4xx error.
  `void`
  `onHttp5xx(IdUserDomain type)`
  An HTTP request resulted in a 5xx error.
  `void`
  `onHttpRequested(IdUserDomain type)`
  An HTTP request was received.
  `void`
  `onHttpRequestSize(IdUserDomain type, long size)`
  An HTTP request was received of a given size.
  `void`
  `onHttpResponseSize(IdUserDomain type, long size)`
  An HTTP response was produced of a given size.
  `void`
  `onHttpResponseTime(IdUserDomain type, Duration time)`
  An HTTP response was produced in the given time.
  `void`
  `onLogin(IdUserDomain type, long countNow)`
  A login session was created.
  `void`
  `onLoginClosed(IdUserDomain type, long countNow)`
  A login session was closed or expired.
  `void`
  `onLoginPauseTime(IdUserDomain type, Duration duration)`
  The login pause time is known.
  `void`
  `onMailFailed(IdEmail address, Duration time)`
  Mail could not be sent to the given address.
  `void`
  `onMailSent(IdEmail address, Duration time)`
  Mail was sent to the given address.
  `void`
  `onRateLimitTriggered(String name, String host, String user, String operation)`
  A rate limit was triggered.
  `String`
  `toString()`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### IdMetricsService

    public IdMetricsService(IdServerTelemetryServiceType telemetry)
    The metrics service.
    Parameters:
      `telemetry` - The underlying telemetry system

- ## Method Details

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### description

    public String description()
    Specified by:
      `description` in interface `com.io7m.repetoir.core.RPServiceType`

  - ### close

    public void close() throws Exception
    Specified by:
      `close` in interface `AutoCloseable`
    Throws:
      `Exception`

  - ### onHttpRequested

    public void onHttpRequested(IdUserDomain type)
    Description copied from interface: `IdMetricsServiceType`
    An HTTP request was received.
    Specified by:
      `onHttpRequested` in interface `IdMetricsServiceType`
    Parameters:
      `type` - The user domain

  - ### onHttp5xx

    public void onHttp5xx(IdUserDomain type)
    Description copied from interface: `IdMetricsServiceType`
    An HTTP request resulted in a 5xx error.
    Specified by:
      `onHttp5xx` in interface `IdMetricsServiceType`
    Parameters:
      `type` - The user domain

  - ### onHttp2xx

    public void onHttp2xx(IdUserDomain type)
    Description copied from interface: `IdMetricsServiceType`
    An HTTP request resulted in a 2xx success.
    Specified by:
      `onHttp2xx` in interface `IdMetricsServiceType`
    Parameters:
      `type` - The user domain

  - ### onHttp4xx

    public void onHttp4xx(IdUserDomain type)
    Description copied from interface: `IdMetricsServiceType`
    An HTTP request resulted in a 4xx error.
    Specified by:
      `onHttp4xx` in interface `IdMetricsServiceType`
    Parameters:
      `type` - The user domain

  - ### onHttpRequestSize

    public void onHttpRequestSize(IdUserDomain type, long size)
    Description copied from interface: `IdMetricsServiceType`
    An HTTP request was received of a given size.
    Specified by:
      `onHttpRequestSize` in interface `IdMetricsServiceType`
    Parameters:
      `type` - The user domain
      `size` - The size

  - ### onHttpResponseSize

    public void onHttpResponseSize(IdUserDomain type, long size)
    Description copied from interface: `IdMetricsServiceType`
    An HTTP response was produced of a given size.
    Specified by:
      `onHttpResponseSize` in interface `IdMetricsServiceType`
    Parameters:
      `type` - The user domain
      `size` - The size

  - ### onMailSent

    public void onMailSent(IdEmail address, Duration time)
    Description copied from interface: `IdMetricsServiceType`
    Mail was sent to the given address.
    Specified by:
      `onMailSent` in interface `IdMetricsServiceType`
    Parameters:
      `address` - The address
      `time` - The time it took

  - ### onMailFailed

    public void onMailFailed(IdEmail address, Duration time)
    Description copied from interface: `IdMetricsServiceType`
    Mail could not be sent to the given address.
    Specified by:
      `onMailFailed` in interface `IdMetricsServiceType`
    Parameters:
      `address` - The address
      `time` - The time it took

  - ### onRateLimitTriggered

    public void onRateLimitTriggered(String name, String host, String user, String operation)
    Description copied from interface: `IdMetricsServiceType`
    A rate limit was triggered.
    Specified by:
      `onRateLimitTriggered` in interface `IdMetricsServiceType`
    Parameters:
      `name` - The rate name
      `host` - The host
      `user` - The user
      `operation` - The operation

  - ### onHttpResponseTime

    public void onHttpResponseTime(IdUserDomain type, Duration time)
    Description copied from interface: `IdMetricsServiceType`
    An HTTP response was produced in the given time.
    Specified by:
      `onHttpResponseTime` in interface `IdMetricsServiceType`
    Parameters:
      `type` - The user domain
      `time` - The time

  - ### onLogin

    public void onLogin(IdUserDomain type, long countNow)
    Description copied from interface: `IdMetricsServiceType`
    A login session was created.
    Specified by:
      `onLogin` in interface `IdMetricsServiceType`
    Parameters:
      `type` - The type of session
      `countNow` - The number of sessions now active

  - ### onLoginClosed

    public void onLoginClosed(IdUserDomain type, long countNow)
    Description copied from interface: `IdMetricsServiceType`
    A login session was closed or expired.
    Specified by:
      `onLoginClosed` in interface `IdMetricsServiceType`
    Parameters:
      `type` - The type of session
      `countNow` - The number of sessions now active

  - ### onLoginPauseTime

    public void onLoginPauseTime(IdUserDomain type, Duration duration)
    Description copied from interface: `IdMetricsServiceType`
    The login pause time is known.
    Specified by:
      `onLoginPauseTime` in interface `IdMetricsServiceType`
    Parameters:
      `type` - The user domain
      `duration` - The pause time

  - ### onClosedForMaintenance

    public void onClosedForMaintenance(boolean closed)
    Description copied from interface: `IdMetricsServiceType`
    The server is open for business, or closed for maintenance.
    Specified by:
      `onClosedForMaintenance` in interface `IdMetricsServiceType`
    Parameters:
      `closed` - `true` if the server is closed