NIFI-15576 ConsumeKinesis processor should log lag metric in milliseconds#10881
NIFI-15576 ConsumeKinesis processor should log lag metric in milliseconds#10881lkuchars wants to merge 8 commits intoapache:mainfrom
Conversation
awelless
left a comment
There was a problem hiding this comment.
Thanks for the changes.
I have 2 main concerns:
- Using a minimum for
millisBehindLatestseems to be more misleading than using the latest value. - The meaning of the gauge and caveats of using it should be explicitly mentioned in the processor documentation.
...ws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/MemoryBoundRecordBuffer.java
Outdated
Show resolved
Hide resolved
...le/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesis.java
Show resolved
Hide resolved
.../nifi-aws-kinesis/src/test/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesisIT.java
Outdated
Show resolved
Hide resolved
...inesis/src/test/java/org/apache/nifi/processors/aws/kinesis/MemoryBoundRecordBufferTest.java
Outdated
Show resolved
Hide resolved
...ndle/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/RecordBuffer.java
Outdated
Show resolved
Hide resolved
6e1c3ce to
40cb736
Compare
awelless
left a comment
There was a problem hiding this comment.
Originally, only gauge was registered.
Do we need to also write MILLIS_BEHIND_LATEST FlowFile attribute?
| @WritesAttribute(attribute = MILLIS_BEHIND_LATEST, | ||
| description = "Milliseconds behind the latest record in the shard at the time records were consumed"), |
There was a problem hiding this comment.
Originally the issue was about writing millis behind latest in a gauge.
Do we need to write it to FlowFile attributes too?
There was a problem hiding this comment.
If this attribute will be needed downstream, no problems.
But I wouldn't put it in FlowFile attributes if it's only caused by the gauge name format.
...ws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/MemoryBoundRecordBuffer.java
Outdated
Show resolved
Hide resolved
…d add flow file attribute aws.kinesis.millis.behind.latest equal to KCL millisBehindLatestValue
3dc789b to
23118ab
Compare
...le/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesis.java
Show resolved
Hide resolved
| @WritesAttribute(attribute = MILLIS_BEHIND_LATEST, | ||
| description = "Milliseconds behind the latest record in the shard at the time records were consumed"), |
There was a problem hiding this comment.
If this attribute will be needed downstream, no problems.
But I wouldn't put it in FlowFile attributes if it's only caused by the gauge name format.
...le/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesis.java
Outdated
Show resolved
Hide resolved
pvillard31
left a comment
There was a problem hiding this comment.
Minor stylish comments.
...le/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesis.java
Outdated
Show resolved
Hide resolved
.../nifi-aws-kinesis/src/test/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesisIT.java
Outdated
Show resolved
Hide resolved
...-kinesis/src/test/java/org/apache/nifi/processors/aws/kinesis/ReaderRecordProcessorTest.java
Outdated
Show resolved
Hide resolved
...inesis/src/test/java/org/apache/nifi/processors/aws/kinesis/MemoryBoundRecordBufferTest.java
Outdated
Show resolved
Hide resolved
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for working on this addition @lkuchars.
The general approach of recording lag is useful, but the naming of millisBehindLatest is not very intuitive. The PR title indicates lag, so something that includes lag seems better, and removing millis, although perhaps less clear, would make the name less verbose. The main issue is the object of latest being unclear. This seems analogous to the currentLag feature of Kafka in some ways, so what do you think about calling it current.lag instead?
Thanks for the review @exceptionfactory! Yep, |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks @lkuchars, this looks close to completion, I noted a couple minor comments.
| final List<KinesisClientRecord> records = createTestRecords(2); | ||
|
|
||
| recordBuffer.addRecords(bufferId, records, checkpointer1); | ||
| recordBuffer.addRecords(bufferId, records, checkpointer1, 100L); |
There was a problem hiding this comment.
It looks like the repeated value of 100 can be declared once and reused across all methods
| } | ||
| } | ||
|
|
||
| static String makeCurrentLagGaugeName(final String streamName, final String shardId) { |
There was a problem hiding this comment.
This method should be made private and the test class should be changed to have its own expected format instead.
|
|
||
| | Name | Type | Description | | ||
| |----------------------------------------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| | `aws.kinesis.current.lag[stream.name="<stream>",shard.id="<shard>"]` | Gauge | The number of milliseconds the consumer is behind the tip of the shard, as reported by the Kinesis Client Library. There is one gauge per stream/shard combination. The gauge is updated each time a batch of records is successfully processed and the session is committed. A value of `0` means the consumer is caught up. | |
There was a problem hiding this comment.
The description mentions a value of 0, but does not mention the value might not be recorded if it is null. Should that be mentioned?
There was a problem hiding this comment.
I've added a mention
Summary
NIFI-15576
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000VerifiedstatusPull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
./mvnw clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation