Monitor the Openflow Connector for Amazon Kinesis Data Streams

The connector writes the metrics described on this page to your Openflow event table. For generic Openflow telemetry, see Openflow telemetry.

Metrics for consuming data from Kinesis

All metrics include the same resource and connector attributes as application metrics. Additionally, they include Kinesis-specific metric attributes.

MetricTypeResolutionDescription
kinesis.consumer.milliseconds.behindGaugeStream and shardHighest age, in milliseconds, of the records the consumer is reading. Reported every 60 seconds for shards the connector owns, including when a read returns no new records.
kinesis.records.consumedCounterStream and shardNumber of Kinesis records consumed during the reporting interval. Reported every 60 seconds for every stream and shard that consumed records since the last report.
kinesis.bytes.consumedCounterStream and shardNumber of bytes consumed during the reporting interval. The partition key isn’t included. Reported every 60 seconds for every stream and shard that consumed records since the last report.
kinesis.records.parsed.errorsCounterStream and shardNumber of records that failed to parse during the reporting interval. Reported every 60 seconds for every stream and shard with a parse error since the last report.

These metrics support up to 10,000 stream and shard combinations in a single runtime. Above that limit, further combinations are reported together.

The connector reports these metrics when it reads the data, before the batch is committed. A batch that is read again is counted again.

Kinesis-specific metric attributes

Kinesis metrics include the following metric attributes:

AttributeDescription
aws.kinesis.stream.nameName of the Kinesis stream.
aws.kinesis.shard.idIdentifier of the shard.

Metrics for pushing data to Snowpipe Streaming

All metrics include the same resource and connector attributes as application metrics. Additionally, they can also include source and destination metric attributes.

These metrics are reported when the Metric Resolution property is Destination or Source and Destination. This property can be set on the PublishSnowpipeStreaming processor inside your connector or custom flow.

MetricTypeResolutionDescription
snowpipe.streaming.rows.sentCounterDestinationNumber of rows sent to Snowpipe Streaming after a successful insert. Reported every 60 seconds for every destination that received data since the last report.
snowpipe.streaming.bytes.sentCounterDestinationNumber of uncompressed bytes sent to Snowpipe Streaming, measured before compression. Reported every 60 seconds for every destination that received data since the last report.
snowpipe.streaming.last.push.timeGaugeDestinationTime when rows were last pushed to Snowpipe Streaming, in milliseconds since the UNIX epoch. Reported every 60 seconds for up to 3 days after the last push, even when no new rows are pushed.
snowpipe.streaming.consume.to.push.latencyGaugeDestinationHighest time, in milliseconds, from when the connector read the data until the rows were pushed to Snowpipe Streaming. Reported every 60 seconds for every destination that received data since the last report.

These metrics support up to 10,000 destinations in a single runtime. Above that limit, metrics might be lost.

The connector reports these metrics after a successful insert using Snowpipe Streaming.

How the lag and latency metrics relate

A record passes through consecutive stages: it waits in the source until the connector reads it, the connector processes it and pushes it to Snowpipe Streaming, and then Snowpipe Streaming makes the rows queryable. The metrics cover these stages as follows:

  • Consumer lag (kinesis.consumer.milliseconds.behind) covers how far the connector is behind the latest record in the shard.
  • Push latency (snowpipe.streaming.consume.to.push.latency) covers the time from when the connector reads the data until the rows are pushed to Snowpipe Streaming.

The time until pushed rows become queryable doesn’t have its own metric, and there’s no end-to-end latency metric. A reported push doesn’t mean that the rows are queryable yet.

Each metric reports the highest value in each 1-minute reporting interval. Because these are maximums, and the consumer lag is reported per stream and shard while the push latency is reported per destination, the values don’t add up exactly.

Source and destination metric attributes

These metrics can include the following metric attributes:

AttributeDescription
destination.database.nameName of the destination database.
destination.schema.nameName of the destination schema.
destination.pipe.nameName of the pipe. When the destination is a table, this is the default pipe in the form of {table}-STREAMING.
source.nameValue of the Source Name property.

The destination.* attributes are included when Metric Resolution on PublishSnowpipeStreaming processor is Destination or Source and Destination. source.name is included only when Metric Resolution is Source and Destination.

In this connector, set the Source Name property to ${aws.kinesis.stream.name}. A merge keeps Source Name when every merged FlowFile has the same value. A merge of different sources can drop Source Name. If Source Name is blank or missing, including when a merge drops it, the rows are still counted and the source.name attribute is omitted.

Example queries

The following queries assume that Openflow sends telemetry to the default event table, SNOWFLAKE.TELEMETRY.EVENTS. If you use a different event table, substitute its name.

Count records consumed

This query returns the number of records consumed for each stream and shard per hour in the last 24 hours. Each value covers one 60-second interval, so the query sums the values:

SELECT
  DATE_TRUNC(hour, timestamp) AS hour,
  record_attributes:"connector.name"::STRING AS connector,
  record_attributes:"aws.kinesis.stream.name"::STRING AS stream_name,
  record_attributes:"aws.kinesis.shard.id"::STRING AS shard_id,
  SUM(value::NUMBER) AS records
FROM SNOWFLAKE.TELEMETRY.EVENTS
WHERE timestamp > DATEADD(day, -1, SYSDATE())
  AND record_type = 'METRIC'
  AND record:metric:name = 'kinesis.records.consumed'
GROUP BY hour, connector, stream_name, shard_id
ORDER BY hour;

Plot consumer lag over time

This query returns the highest age of the records read for each stream and shard over the last 24 hours. To plot it, show the results as a line chart with timestamp on the X-axis and age_seconds on the Y-axis.

SELECT
  timestamp,
  record_attributes:"connector.name"::STRING AS connector,
  record_attributes:"aws.kinesis.stream.name"::STRING AS stream_name,
  record_attributes:"aws.kinesis.shard.id"::STRING AS shard_id,
  value::NUMBER / 1000 AS age_seconds
FROM SNOWFLAKE.TELEMETRY.EVENTS
WHERE timestamp > DATEADD(day, -1, SYSDATE())
  AND record_type = 'METRIC'
  AND record:metric:name = 'kinesis.consumer.milliseconds.behind'
ORDER BY timestamp;

Count rows sent to each destination

This query returns the number of rows sent for each destination per hour in the last 24 hours. Each value covers one 60-second interval, so the query sums the values:

SELECT
  DATE_TRUNC(hour, timestamp) AS hour,
  record_attributes:"connector.name"::STRING AS connector,
  record_attributes:"destination.database.name"::STRING AS destination_database,
  record_attributes:"destination.schema.name"::STRING AS destination_schema,
  record_attributes:"destination.pipe.name"::STRING AS destination_pipe,
  SUM(value::NUMBER) AS rows_sent
FROM SNOWFLAKE.TELEMETRY.EVENTS
WHERE timestamp > DATEADD(day, -1, SYSDATE())
  AND record_type = 'METRIC'
  AND record:metric:name = 'snowpipe.streaming.rows.sent'
GROUP BY hour, connector, destination_database, destination_schema, destination_pipe
ORDER BY hour;

Plot push latency over time

This query returns the highest time from when the connector read the data until it was pushed to Snowpipe Streaming, for each destination over the last 24 hours. To plot it, show the results as a line chart with timestamp on the X-axis and latency_seconds on the Y-axis.

SELECT
  timestamp,
  record_attributes:"connector.name"::STRING AS connector,
  record_attributes:"destination.database.name"::STRING AS destination_database,
  record_attributes:"destination.schema.name"::STRING AS destination_schema,
  record_attributes:"destination.pipe.name"::STRING AS destination_pipe,
  value::NUMBER / 1000 AS latency_seconds
FROM SNOWFLAKE.TELEMETRY.EVENTS
WHERE timestamp > DATEADD(day, -1, SYSDATE())
  AND record_type = 'METRIC'
  AND record:metric:name = 'snowpipe.streaming.consume.to.push.latency'
ORDER BY timestamp;