Metric Sink

The Metric Sink microservice takes metrics that have been normalized and inserts them into the Metric database.

This microservice is part of the Metric microservice pipeline. See Understanding Microservice Pipelines in Unified Assurance Concepts for conceptual information.

Autoscaling is enabled by default for this microservice. You can optionally disable autoscaling when you deploy the microservice. See Configuring Autoscaling.

This microservice provides additional Prometheus monitoring metrics. See Metric Sink Self-Monitoring Metrics.

Metric Sink Prerequisites

Before deploying the microservice, confirm that the following prerequisites are met:

  1. A microservice cluster is set up. See Microservice Cluster Setup.

  2. The Apache Pulsar microservice is deployed. See Pulsar.

Deploying Metric Sink

To deploy the microservice, run the following commands:

su - assure1
export NAMESPACE=<namespace>
export WEBFQDN=<WebFQDN> 
a1helm install <microservice-release-name> assure1/metric-sink -n $NAMESPACE --set global.imageRegistry=$WEBFQDN

In the commands:

You can also use the Unified Assurance UI to deploy microservices. See Deploying a Microservice by Using the UI for more information.

Changing Metric Sink Configuration Parameters

When running the install command, you can optionally change default configuration parameter values by including them in the command with additional --set arguments. You can add as many additional --set arguments as you need.

For example:

Default Metric Sink Configuration

The following table describes the default configuration parameters found in the Helm chart under configData for the microservice.

Name Default Value Possible Values Notes
LOG_LEVEL INFO FATAL, ERROR, WARN, INFO, DEBUG Logging level used by application.
STREAM_INPUT persistent://assure1/metric/sink Text, 255 characters Apache Pulsar topic path. Topic at end of path may be any text value.

Metric Sink Autoscaling Configuration

Autoscaling is supported for the Metric Sink microservice. See Configuring Autoscaling for general information and details about the standard autoscaling configurations.

The Metric Sink microservice also supports the additional configurations described in the following table.

Name Default Value Possible Values Notes
thresholds.backlogSize 1000 Integer The number of items that need to be in the backlog before the autoscaling starts additional processes.
thresholds.totalMetricsProcessed 400 Integer Total metrics processed by the microservice. If the average of total metrics processed in five minutes exceeds the threshold, pods will be scaled.

Metric Sink Self-Monitoring Metrics

The Metric Sink microservice exposes the self-monitoring metrics described in the following table to Prometheus.

Metric Name Type Description
metric_sink_backlog_size Gauge Number of items pending in the backlog
total_metrics_processed Counter Number of metrics processed
processing_time_per_metric Gauge processing time per metric from receiving it to sending it to acknowledging it

Note:

Metric names in the database include a prefix that indicates the service that inserted them. The prefix is prom_ for metrics inserted by Prometheus. For example, total_metrics_processed is stored as prom_total_metrics_processed in the database.

Sample JSON Metric Schema

The following example shows the expected JSON file schema formats for Metric Sink.

{
    "@timestamp":  "2021-05-06T18:40:00.000Z",
    "measurement": "iot_test",
    "tags": {
        "host":     "some_host",
        "instance": "some_instance"
    },
    "fields": {
        "availability": 1,
        "value":        123456789000,
        "utilization":  0.1,
        "other":        1
    }
}

Although you are responsible for defining the proper format, the Metric Sink microservice tries to match the current Metric schema. For example, it cleans up slash marks (), replaces dashes (-) and spaces with underscores (_) and capitalizes letters as needed.

Debugging Metric Sink

The Metric Sink microservice consists of two components: metric-sink and telegraf. To see logs for each of the components, run the following commands (replacing appropriate parameters).

For metric-sink logs:

a1k logs <pod_name> -n <namespace> metric-sink

For telegraf logs:

a1k logs <pod_name> -n <namespace> telegraf

You can get pod names and namespaces by running the following command:

a1k get pods --all-namespaces