Class GrpcConnectionMetrics

java.lang.Object
com.oracle.coherence.grpc.proxy.GrpcConnectionMetrics

public class GrpcConnectionMetrics extends Object
A holder for gRPC connection metrics.

This is a singleton so that one instance can track all connections in a process.

Because there is no way to actually track gRPC connections this holder tracks them using the remote address in the request header, so each unique address is a connection.

As there is no tracking of connection closed the connection metrics will expire and be removed after a period of inactivity. The default is five minutes, but this may be changed using the PROP_CONNECTION_TTL system property.

Author:
Jonathan Knight 2020.10.16
  • Field Details

    • PROP_CONNECTION_TTL

      public static final String PROP_CONNECTION_TTL
      The system property used to set the expiry time used to evict connection MBeans when connections have had no activity for a period of time.
      See Also:
    • MBEAN_TYPE

      public static final String MBEAN_TYPE
      The connection MBean type.
      See Also:
    • MBEAN_PREFIX

      public static final String MBEAN_PREFIX
      The connection MBean ObjectName prefix.
      See Also:
  • Method Details

    • getInstance

      public static GrpcConnectionMetrics getInstance()
      Returns the singleton instance of GrpcConnectionMetrics.
      Returns:
      the singleton instance of GrpcConnectionMetrics
    • register

      public void register(io.grpc.ServerCall<?,?> call)
      Register a ServerCall with the connection metrics, creating a new connection metric if this call is from a new remote address.
      Parameters:
      call - the ServerCall to register