import {Ice} from 'ice'; import '../Ice/BuiltinSequences'; declare module '../IceMX.ns' { namespace IceMX { /** * A dictionnary of strings to integers. */ type StringIntDict = Map; const StringIntDict: { /** * A dictionnary of strings to integers. */ new (entries?: ReadonlyArray<[string, number]>): StringIntDict; }; /** * The base class for metrics. A metrics object represents a * collection of measurements associated to a given a system. */ class Metrics extends Ice.Value { constructor( id?: string, total?: Ice.Long, current?: number, totalLifetime?: Ice.Long, failures?: number, ); /** * The metrics identifier. */ id: string; /** * The total number of objects that were observed by this metrics. */ total: Ice.Long; /** * The current number of objects observed by this metrics. */ current: number; /** * The sum of the lifetime of each observed objects. This does not * include the lifetime of objects which are currently observed. */ totalLifetime: Ice.Long; /** * The number of failures observed. */ failures: number; } /** * A structure to keep track of failures associated with a given * metrics. */ class MetricsFailures implements Ice.Struct { constructor(id?: string, failures?: StringIntDict); /** * The identifier of the metrics object associated to the * failures. */ id: string; /** * The failures observed for this metrics. */ failures: StringIntDict; clone(): this; equals(other: this): boolean; hashCode(): number; } /** * A sequence of {@link MetricsFailures}. */ type MetricsFailuresSeq = Array; /** * A metrics map is a sequence of metrics. We use a sequence here * instead of a map because the ID of the metrics is already included * in the Metrics class and using sequences of metrics objects is more * efficient than using dictionaries since lookup is not necessary. */ type MetricsMap = Array; /** * A metrics view is a dictionary of metrics map. The key of the * dictionary is the name of the metrics map. */ type MetricsView = Map; const MetricsView: { /** * A metrics view is a dictionary of metrics map. The key of the * dictionary is the name of the metrics map. */ new (entries?: ReadonlyArray<[string, MetricsMap]>): MetricsView; }; /** * Raised if a metrics view cannot be found. */ class UnknownMetricsView extends Ice.UserException {} /** * The metrics administrative facet interface. This interface allows * remote administrative clients to access metrics of an application * that enabled the Ice administrative facility and configured some * metrics views. */ abstract class MetricsAdmin extends Ice.Object { /** * Get the names of enabled and disabled metrics. * * @param disabledViews The names of the disabled views. * * @return The name of the enabled views. */ abstract getMetricsViewNames( current: Ice.Current, ): Ice.OperationResult<[Ice.StringSeq, Ice.StringSeq]>; /** * Enables a metrics view. * * @param name The metrics view name. * * @throws UnknownMetricsView Raised if the metrics view cannot be * found. */ abstract enableMetricsView( name: string, current: Ice.Current, ): Ice.OperationResult; /** * Disable a metrics view. * * @param name The metrics view name. * * @throws UnknownMetricsView Raised if the metrics view cannot be * found. */ abstract disableMetricsView( name: string, current: Ice.Current, ): Ice.OperationResult; /** * Get the metrics objects for the given metrics view. This * returns a dictionnary of metric maps for each metrics class * configured with the view. The timestamp allows the client to * compute averages which are not dependent of the invocation * latency for this operation. * * @param view The name of the metrics view. * * @param timestamp The local time of the process when the metrics * object were retrieved. * * @return The metrics view data. * * @throws UnknownMetricsView Raised if the metrics view cannot be * found. */ abstract getMetricsView( view: string, current: Ice.Current, ): Ice.OperationResult<[MetricsView, Ice.Long]>; /** * Get the metrics failures associated with the given view and map. * * @param view The name of the metrics view. * * @param map The name of the metrics map. * * @return The metrics failures associated with the map. * * @throws UnknownMetricsView Raised if the metrics view cannot be * found. */ abstract getMapMetricsFailures( view: string, map: string, current: Ice.Current, ): Ice.OperationResult; /** * Get the metrics failure associated for the given metrics. * * @param view The name of the metrics view. * * @param map The name of the metrics map. * * @param id The ID of the metrics. * * @return The metrics failures associated with the metrics. * * @throws UnknownMetricsView Raised if the metrics view cannot be * found. */ abstract getMetricsFailures( view: string, map: string, id: string, current: Ice.Current, ): Ice.OperationResult; } /** * The metrics administrative facet interface. This interface allows * remote administrative clients to access metrics of an application * that enabled the Ice administrative facility and configured some * metrics views. */ class MetricsAdminPrx extends Ice.ObjectPrx { /** * Get the names of enabled and disabled metrics. * * @param disabledViews The names of the disabled views. * * @return The name of the enabled views. */ getMetricsViewNames( ctx?: Ice.Context, ): Ice.AsyncResult<[Ice.StringSeq, Ice.StringSeq]>; /** * Enables a metrics view. * * @param name The metrics view name. * * @throws UnknownMetricsView Raised if the metrics view cannot be * found. */ enableMetricsView(name: string, ctx?: Ice.Context): Ice.AsyncResult; /** * Disable a metrics view. * * @param name The metrics view name. * * @throws UnknownMetricsView Raised if the metrics view cannot be * found. */ disableMetricsView( name: string, ctx?: Ice.Context, ): Ice.AsyncResult; /** * Get the metrics objects for the given metrics view. This * returns a dictionnary of metric maps for each metrics class * configured with the view. The timestamp allows the client to * compute averages which are not dependent of the invocation * latency for this operation. * * @param view The name of the metrics view. * * @param timestamp The local time of the process when the metrics * object were retrieved. * * @return The metrics view data. * * @throws UnknownMetricsView Raised if the metrics view cannot be * found. */ getMetricsView( view: string, ctx?: Ice.Context, ): Ice.AsyncResult<[MetricsView, Ice.Long]>; /** * Get the metrics failures associated with the given view and map. * * @param view The name of the metrics view. * * @param map The name of the metrics map. * * @return The metrics failures associated with the map. * * @throws UnknownMetricsView Raised if the metrics view cannot be * found. */ getMapMetricsFailures( view: string, map: string, ctx?: Ice.Context, ): Ice.AsyncResult; /** * Get the metrics failure associated for the given metrics. * * @param view The name of the metrics view. * * @param map The name of the metrics map. * * @param id The ID of the metrics. * * @return The metrics failures associated with the metrics. * * @throws UnknownMetricsView Raised if the metrics view cannot be * found. */ getMetricsFailures( view: string, map: string, id: string, ctx?: Ice.Context, ): Ice.AsyncResult; } /** * Provides information on the number of threads currently in use and * their activity. */ class ThreadMetrics extends Metrics { constructor( id?: string, total?: Ice.Long, current?: number, totalLifetime?: Ice.Long, failures?: number, inUseForIO?: number, inUseForUser?: number, inUseForOther?: number, ); /** * The number of threads which are currently performing socket * read or writes. */ inUseForIO: number; /** * The number of threads which are currently calling user code * (servant dispatch, AMI callbacks, etc). */ inUseForUser: number; /** * The number of threads which are currently performing other * activities. These are all other that are not counted with * {@link #inUseForUser} or {@link #inUseForIO}, such as DNS * lookups, garbage collection). */ inUseForOther: number; } /** * Provides information on servant dispatch. */ class DispatchMetrics extends Metrics { constructor( id?: string, total?: Ice.Long, current?: number, totalLifetime?: Ice.Long, failures?: number, userException?: number, size?: Ice.Long, replySize?: Ice.Long, ); /** * The number of dispatch that failed with a user exception. */ userException: number; /** * The size of the dispatch. This corresponds to the size of the * marshalled input parameters. */ size: Ice.Long; /** * The size of the dispatch reply. This corresponds to the size of * the marshalled output and return parameters. */ replySize: Ice.Long; } /** * Provides information on child invocations. A child invocation is * either remote (sent over an Ice connection) or collocated. An * invocation can have multiple child invocation if it is * retried. Child invocation metrics are embedded within {@link * InvocationMetrics}. */ class ChildInvocationMetrics extends Metrics { constructor( id?: string, total?: Ice.Long, current?: number, totalLifetime?: Ice.Long, failures?: number, size?: Ice.Long, replySize?: Ice.Long, ); /** * The size of the invocation. This corresponds to the size of the * marshalled input parameters. */ size: Ice.Long; /** * The size of the invocation reply. This corresponds to the size * of the marshalled output and return parameters. */ replySize: Ice.Long; } /** * Provides information on invocations that are collocated. Collocated * metrics are embedded within {@link InvocationMetrics}. */ class CollocatedMetrics extends ChildInvocationMetrics {} /** * Provides information on invocations that are specifically sent over * Ice connections. Remote metrics are embedded within {@link * InvocationMetrics}. */ class RemoteMetrics extends ChildInvocationMetrics {} /** * Provide measurements for proxy invocations. Proxy invocations can * either be sent over the wire or be collocated. */ class InvocationMetrics extends Metrics { constructor( id?: string, total?: Ice.Long, current?: number, totalLifetime?: Ice.Long, failures?: number, retry?: number, userException?: number, remotes?: MetricsMap, collocated?: MetricsMap, ); /** * The number of retries for the invocation(s). */ retry: number; /** * The number of invocations that failed with a user exception. */ userException: number; /** * The remote invocation metrics map. * * @see RemoteMetrics */ remotes: MetricsMap; /** * The collocated invocation metrics map. * * @see CollocatedMetrics */ collocated: MetricsMap; } /** * Provides information on the data sent and received over Ice * connections. */ class ConnectionMetrics extends Metrics { constructor( id?: string, total?: Ice.Long, current?: number, totalLifetime?: Ice.Long, failures?: number, receivedBytes?: Ice.Long, sentBytes?: Ice.Long, ); /** * The number of bytes received by the connection. */ receivedBytes: Ice.Long; /** * The number of bytes sent by the connection. */ sentBytes: Ice.Long; } } } export {IceMX} from '../IceMX.ns';