feat: (issue 2429) read gRPC hiero-correlation-id header and prefix publisher handler logs#2534
feat: (issue 2429) read gRPC hiero-correlation-id header and prefix publisher handler logs#2534
Conversation
7ca55b6 to
00245da
Compare
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
TIP This summary will be updated as you push new changes. Give us feedback
658508e to
a221322
Compare
239da61 to
dce9517
Compare
jsync-swirlds
left a comment
There was a problem hiding this comment.
The way this was added isn't good and breaks some important metrics.
...e/stream-publisher/src/main/java/org/hiero/block/node/stream/publisher/PublisherHandler.java
Outdated
Show resolved
Hide resolved
...e/stream-publisher/src/main/java/org/hiero/block/node/stream/publisher/PublisherHandler.java
Outdated
Show resolved
Hide resolved
...e/stream-publisher/src/main/java/org/hiero/block/node/stream/publisher/PublisherHandler.java
Outdated
Show resolved
Hide resolved
...e/stream-publisher/src/main/java/org/hiero/block/node/stream/publisher/PublisherHandler.java
Outdated
Show resolved
Hide resolved
...e/stream-publisher/src/main/java/org/hiero/block/node/stream/publisher/PublisherHandler.java
Outdated
Show resolved
Hide resolved
...e/stream-publisher/src/main/java/org/hiero/block/node/stream/publisher/PublisherHandler.java
Outdated
Show resolved
Hide resolved
...e/stream-publisher/src/main/java/org/hiero/block/node/stream/publisher/PublisherHandler.java
Outdated
Show resolved
Hide resolved
...e/stream-publisher/src/main/java/org/hiero/block/node/stream/publisher/PublisherHandler.java
Outdated
Show resolved
Hide resolved
...sher/src/test/java/org/hiero/block/node/stream/publisher/LiveStreamPublisherManagerTest.java
Outdated
Show resolved
Hide resolved
...ream-publisher/src/test/java/org/hiero/block/node/stream/publisher/PublisherHandlerTest.java
Show resolved
Hide resolved
...eam-publisher/src/main/java/org/hiero/block/node/stream/publisher/StreamPublisherPlugin.java
Show resolved
Hide resolved
Nana-EC
left a comment
There was a problem hiding this comment.
Good start including passing through call chain and pre-computing correlationIdPrefix, character truncations and test additions.
@jsync-swirlds covered most of the cases I'm concerned about with respect to perf and breaking log layouts for other telemetry.
Also kindly add a PR description that makes it easier for reviewers to understand what they are reviewing and the impact
...sher/src/test/java/org/hiero/block/node/stream/publisher/LiveStreamPublisherManagerTest.java
Outdated
Show resolved
Hide resolved
…ler logs Signed-off-by: a-saksena <anurag@swirldslabs.com>
…ublisher handler logs. Signed-off-by: a-saksena <anurag@swirldslabs.com>
Signed-off-by: a-saksena <anurag@swirldslabs.com>
Signed-off-by: a-saksena <anurag@swirldslabs.com>
…orrelation-id header and prefix publisher handler logs Signed-off-by: a-saksena <anurag@swirldslabs.com>
c8b1a3b to
48c46a3
Compare
Signed-off-by: a-saksena <anurag@swirldslabs.com>
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #2534 +/- ##
============================================
+ Coverage 81.27% 81.47% +0.19%
- Complexity 1512 1526 +14
============================================
Files 139 139
Lines 7131 7162 +31
Branches 754 757 +3
============================================
+ Hits 5796 5835 +39
- Misses 1010 1012 +2
+ Partials 325 315 -10
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
| LOGGER.log(TRACE, ackMessage, newLastAcknowledgedBlockNumber, handlerId); | ||
| LOGGER.log( | ||
| TRACE, | ||
| "metric-end-to-end-latency-by-block-end block={0,number,#} nsTimestamp={1,number,#} handlerId={2} correlationId=[{3}]", |
There was a problem hiding this comment.
Here we must not include the [] characters; it breaks parsing in Loki.
| LOGGER.log(TRACE, traceMessage, blockNumber, currentStreamingBlockHeaderReceivedTime, handlerId); | ||
| LOGGER.log( | ||
| TRACE, | ||
| "metric-end-to-end-latency-by-block-start block={0,number,#} nsTimestamp={1,number,#} handlerId={2} correlationId=[{3}]", |
There was a problem hiding this comment.
Same here, this is a metric value, so we must not add extra characters that cause parsing issues.
There was a problem hiding this comment.
It's a gap in our documentation but basically anywhere you see the format = is an instance of logs that Loki can convert into telemetry and we can use to create adhoc telemetry.
As such we don't want to break those but you can add key-value pairs to them
| assertThat(responsePipeline.getClientEndStreamCalls().get()).isEqualTo(0); | ||
| } | ||
|
|
||
| /// Verifies that a failed [PersistedNotification] (succeeded = false) |
There was a problem hiding this comment.
These coverage tests will probably conflict with @ata-nas latest changes; so we should be careful about what order we merge the two PRs.
|
|
||
| SDK_DIR="" | ||
| TCK_DIR="" | ||
| TEST_FILE="src/tests/crypto-service/test-transfer-hbar-transaction.ts src/tests/crypto-service/test-account-create-transaction.ts src/tests/crypto-service/test-account-update-transaction.ts src/tests/token-service/test-token-create-transaction.ts src/tests/token-service/test-token-update-transaction.ts src/tests/topic-service/test-topic-create-transaction.ts src/tests/topic-service/test-topic-update-transaction.ts src/tests/contract-service/test-contract-delete-transaction.ts" |
There was a problem hiding this comment.
Why did we remove these?
| if [[ "${TEST_FILE}" == "all" ]]; then | ||
| echo "Running all TCK tests (test:serial)" | ||
| npm run test:serial | ||
| else | ||
| echo "Running TCK tests: $TEST_FILE" | ||
| # shellcheck disable=SC2086 | ||
| # Word splitting is intentional — TEST_FILE may contain multiple space-separated file paths | ||
| npm run test:file $TEST_FILE | ||
| fi |
There was a problem hiding this comment.
Similar concern, this seems to remove the option to run "all" tests.
cc: @Nana-EC
There was a problem hiding this comment.
Yeah, please revert all changes in this file for this PR.
If we want to streamline anything here let's do it separately so this PR doesn't get held up
| manager.getBlockMessagingFacility().getSentNewestBlockKnownToNetworkNotifications(); | ||
| assertThat(sentNotifications).hasSize(0); | ||
| } | ||
|
|
There was a problem hiding this comment.
These should also be examined by @ata-nas to ensure they aren't conflicting with his recent changes.
jsync-swirlds
left a comment
There was a problem hiding this comment.
A couple changes needed for the metric logs.
These are log statements we use Loki to parse into metrics because they're cross-plugin telemetry data we cannot easily turn into useable metrics otherwise.
Nana-EC
left a comment
There was a problem hiding this comment.
Some mote items.
We should scope this to the necessary changes needed but also watch out for the value pairs in logs, those are logs that Loki can turn into telemetry that we specifcally formatted for
| if [[ "${TEST_FILE}" == "all" ]]; then | ||
| echo "Running all TCK tests (test:serial)" | ||
| npm run test:serial | ||
| else | ||
| echo "Running TCK tests: $TEST_FILE" | ||
| # shellcheck disable=SC2086 | ||
| # Word splitting is intentional — TEST_FILE may contain multiple space-separated file paths | ||
| npm run test:file $TEST_FILE | ||
| fi |
There was a problem hiding this comment.
Yeah, please revert all changes in this file for this PR.
If we want to streamline anything here let's do it separately so this PR doesn't get held up
|
|
||
| SDK_DIR="" | ||
| TCK_DIR="" | ||
| TEST_FILE="src/tests/crypto-service/test-transfer-hbar-transaction.ts src/tests/crypto-service/test-account-create-transaction.ts src/tests/crypto-service/test-account-update-transaction.ts src/tests/token-service/test-token-create-transaction.ts src/tests/token-service/test-token-update-transaction.ts src/tests/topic-service/test-topic-create-transaction.ts src/tests/topic-service/test-topic-update-transaction.ts src/tests/contract-service/test-contract-delete-transaction.ts" |
| LOGGER.log(TRACE, traceMessage, blockNumber, currentStreamingBlockHeaderReceivedTime, handlerId); | ||
| LOGGER.log( | ||
| TRACE, | ||
| "metric-end-to-end-latency-by-block-start block={0,number,#} nsTimestamp={1,number,#} handlerId={2} correlationId=[{3}]", |
There was a problem hiding this comment.
It's a gap in our documentation but basically anywhere you see the format = is an instance of logs that Loki can convert into telemetry and we can use to create adhoc telemetry.
As such we don't want to break those but you can add key-value pairs to them
| context.configuration().getConfigData(ServerConfig.class).maxMessageSizeBytes() - 16384; | ||
|
|
||
| final String rawCorrelationId = options.metadata().getOrDefault("hiero-correlation-id", ""); | ||
| if (rawCorrelationId.length() > MAX_CORRELATION_ID_LENGTH) { |
There was a problem hiding this comment.
I think this logic is repeated in truncateCorrelationId so you can get rid of it and just call the method
| if (rawCorrelationId.length() > MAX_CORRELATION_ID_LENGTH) { | ||
| LOGGER.log( | ||
| System.Logger.Level.WARNING, | ||
| "Received hiero-correlation-id header exceeds {0} characters and will be truncated: {1}", |
There was a problem hiding this comment.
May also be worth logging the size that came in so it's clear how much over the limit we're observing
Reviewer Notes
Related Issue(s)
Use keywords
Fix, Fixes, Fixed, Close, Closes, Closed, Resolve, Resolves, Resolvedto connect an issue to be closed by this pull request.