PrometheusCounters

Performance counters that send their metrics to Prometheus service.

Extends: CachedCounters

Implements: IReferenceable, IOpenable

Description

The PrometheusCounters class allows you to create performance counters that send their metrics to Pormetheus service.

Important points

  • The component is normally used in passive mode conjunction with PrometheusMetricsController. Alternatively, when connection parameters are set, it can push metrics to Prometheus PushGateway.

Configuration parameters

connection(s):

  • discovery_key: (optional) key to retrieve the connection from IDiscovery
  • protocol: connection protocol: http or https
  • host: host name or IP address
  • port: port number
  • uri: resource URI or connection string with all parameters in it

options:

  • retries: number of retries (default: 3)
  • connect_timeout: connection timeout in milliseconds (default: 10 sec)
  • timeout: invocation timeout in milliseconds (default: 10 sec)

References

  • *:logger:*:*:1.0 - (optional) ILogger components to pass log messages
  • *:discovery:*:*:1.0 - (optional) IDiscovery services
  • *:counters:*:*:1.0 - (optional) ICounters components to pass collected measurements

Constructors

Creates a new instance of the performance counters.

public constructor()

Instance methods

close

Closes the component and frees used resources.

public void close(IContext context)

  • context: IContext - (optional) a context to trace execution through a call chain.

configure

Configures the component by passing its configuration parameters.

public void configure(ConfigParams config)

  • config: ConfigParams - configuration parameters to be set.

isOpen

Checks if the component is opened.

public boolean isOpen()

  • returns: boolean - True if the component is open and False otherwise.

open

Opens the component.

public void open(IContext context)

  • context: IContext - (optional) a context to trace execution through a call chain.

save

Saves the current counters' measurements.

protected void save(List<Counter> counters)

  • counters: Counter[] - current counters measurements to be saved.

setReferences

Sets references to dependent components.

public void setReferences(IReferences references)

  • references: IReferences - references to locate the component dependencies.

Examples

See also