GuidesChangelogData Inspector Library API Reference
Guides

How to use Data Archiving Library metrics

How to use Data Archiving Library metrics

The Data Archiving Library provides a following set of metrics to monitor the archiving process:

MetricDescription
messageCounternumber of messages read by operator (should be same as number of messages consumed by source)
getDataSuccessCounternumber of messages successfully downloaded from blob-store
getDataFailCounternumber of messages failed to download from blob-store
sizeCountersize of messages (byte array size)
getKeysNullCounternumber of times getKeys/getMultipleKeys/getSplittedKeys API returns null
getKeysFailCounternumber of times getKeys/getMultipleKeys/getSplittedKeys API results in error (null case is included in this metric)
timeWindowMissingCounternumber of times the value of timewindow type index attribute was null
timeWindowInvalidCounternumber of times the value of timewindow type index attribute was invalid (expects long value)
hereTileInvalidZoomLevelCounternumber of times the value of heretile type index attribute is associated with wrong zoom level
hereTileNonParsablelCounternumber of times the value of heretile type index attribute was invalid (expects long value)
invalidColumnValueCounternumber of times the value of any index attribute had unsupported data type (string, int, long, boolean are supported data types)
parserIgnoreCounternumber of messages ignored by the library because of validation error
parserDeadLetterCounternumber of messages marked by the library to archive in dead-letter storage because of validation error
keyPartitionCounternumber of unique index attribute groups in a time-window
aggregateSuccessMessageCounternumber of messages successfully processed by aggregate API
aggregateSuccessSizeCountersize of messages successfully processed by aggregate API
aggregateNullMessageCounternumber of messages for which aggregate API returns null
aggregateNullSizeCountersize of messages for which aggregate API returns null
aggregateFailMessageCounternumber of messages for which aggregate API results in error (null case is included in this metric)
aggregateFailSizeCountersize of messages for which aggregate API results in error (null case is included in this metric)
aggregateIgnoreCounternumber of times the result of aggregate API is ignored
aggregateDeadLetterCounternumber of times the messages passed to aggregate API are aggregated for dead-letter storage
windowDeadLetterMessageCounternumber of messages setup for archival in dead-letter storage
windowDeadLetterSizeCountersize of messages setup for archival in dead-letter storage
transformDeadletterSuccessCounternumber of messages successfully transformed using transformForDeadLetter API for dead-letter storage
transformDeadletterFailCounternumber of messages failed to transform using transformForDeadLetter API for dead-letter storage
blobSuccessRequestCounternumber of files successfully uploaded to blob-store
blobSizeCountersize of files successfully uploaded to blob-store
blobTimeCountertime taken by the library to upload the files to blob-store
indexInvokeCounternumber of index records received by the sink operator (should be same as blobSuccessRequestCounter)
indexUploadCounternumber of index records successfully published to index-store
indexValidCounternumber of index records received by the sink operator for normal archival storage
indexDeadLetterCounternumber of index records received by the sink operator for special dead-letter storage
indexSuccessRequestCounternumber of successful requests to index-store (1 request can have N number of index records)
indexTimeCountertime taken by the library to publish the index records to index-store
indexBatchLimitCounternumber of times the sink operator reached batch limit for number of index records to be published in 1 request
indexTimeoutCounternumber of times the request to publish index records was triggered by timeout

Add user-defined metric

While the Data Archiving Library provides a comprehensive set of the archiving process metrics, the user has the option to define their own metrics using the standard Flink APIs. To define a new custom metric:

  • Add your custom metric as an instance variable in your UDF implementation
public class MyExampleImplementation implements UDF {
private Counter customMetric;
...
}
  • Override the open(Configuration parameters, RuntimeContext runtimeContext) API and register the custom metric which you added in the previous step with the MetricGroup of the provided RuntimeContext. For example:
...
@Override
public void open(Configuration parameters, RuntimeContext runtimeContext) {
    customMetric = runtimeContext.getMetricGroup().counter("myCustomMetric");
}
  • Record the metric in your UDF implementation:
customMetric.inc();
  • The following dependencies should be added with provided scope. Note that this example is for maven build tool.
<dependency>
   <groupId>org.apache.flink</groupId>
   <artifactId>flink-core</artifactId>
   <scope>provided</scope>
</dependency>
<dependency>
   <groupId>org.apache.flink</groupId>
   <artifactId>flink-metrics-core</artifactId>
   <scope>provided</scope>
</dependency>

Refer to com/here/platform/data/archive/example/AvroSimpleKeyExample.java in the HERE Data SDK for Java & Scala Data Archive Avro Example for an example implementation.

Monitoring metrics

Metrics registered with the Flink runtime context will be available in Grafana prefixed with flink_taskmanager_job_task_operator_. For example:

flink_taskmanager_job_task_operator_messageCounter
flink_taskmanager_job_task_operator_myCustomMetric

Refer to the Flink documention to learn more about the scope and naming of metrics.