pip_services3_datadog.count package

Submodules

Module contents

class pip_services3_datadog.count.DataDogCounters

Bases: pip_services3_components.count.CachedCounters.CachedCounters, pip_services3_commons.refer.IReferenceable.IReferenceable, pip_services3_commons.run.IOpenable.IOpenable

Performance counters that send their metrics to DataDog service.

DataDog is a popular monitoring SaaS service. It collects logs, metrics, events from infrastructure and applications and analyze them in a single place.

### Configuration parameters ###
  • connection(s): - discovery_key: (optional) a key to retrieve the connection from IDiscovery

    • protocol: (optional) connection protocol: http or https (default: https)

    • host: (optional) host name or IP address (default: api.datadoghq.com)

    • port: (optional) port number (default: 443)

    • uri: (optional) resource URI or connection string with all parameters in it

  • credential:
    • access_key: DataDog client api key

  • 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

  • *:counters:*:*:1.0 (optional) ICounters components to pass collected measurements

  • *:discovery:*:*:1.0 (optional) IDiscovery services to resolve connection

See: RestService, CommandableHttpService

Example:

counters = DataDogCounters()
counters.configure(ConfigParams.from_tuples(
   "credential.access_key", "827349874395872349875493"
))

counters.open('123')

counters.increment("mycomponent.mymethod.calls")

timing = counters.begin_timing("mycomponent.mymethod.exec_time")

try:
    ...
finally:
    timing.end_timing()

counters.dump()
close(correlation_id: Optional[str])

Closes component and frees used resources.

Parameters

correlation_id – (optional) transaction id to trace execution through call chain.

configure(config: pip_services3_commons.config.ConfigParams.ConfigParams)

Configures component by passing configuration parameters.

Parameters

config – configuration parameters to be set.

is_open() bool

Checks if the component is opened.

Returns

true if the component has been opened and false otherwise.

open(correlation_id: Optional[str])

Opens the component.

Parameters

correlation_id – (optional) transaction id to trace execution through call chain.

set_references(references: pip_services3_commons.refer.IReferences.IReferences)

Sets references to dependent components.

Parameters

references – references to locate the component dependencies.