-
Notifications
You must be signed in to change notification settings - Fork 144
Add create-validation time to stream provisioning metric #1033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dhananjay-sawner
merged 5 commits into
linkedin:master
from
dhananjay-sawner:capture-create-validation-time
Jun 23, 2026
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c57c3b5
Add create-validation time to stream provisioning metric
31fb0b4
Make create-validation time addition explicit
d37c915
Refactoring
f152c5c
Extract create-validation time helper and unit-test it
32fe947
Log creation, create-validation, and total provisioning time
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...stream-server/src/test/java/com/linkedin/datastream/server/TestCoordinatorStandalone.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /** | ||
| * Copyright 2019 LinkedIn Corporation. All rights reserved. | ||
| * Licensed under the BSD 2-Clause License. See the LICENSE file in the project root for license information. | ||
| * See the NOTICE file in the project root for additional information regarding copyright ownership. | ||
| */ | ||
| package com.linkedin.datastream.server; | ||
|
|
||
| import org.testng.Assert; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| import com.linkedin.data.template.StringMap; | ||
| import com.linkedin.datastream.common.Datastream; | ||
|
|
||
| import static com.linkedin.datastream.common.DatastreamMetadataConstants.CREATE_VALIDATION_TIME_MS; | ||
|
|
||
|
|
||
| /** | ||
| * Unit tests for {@link Coordinator} that run standalone, without an embedded cluster. The full | ||
| * integration-style test lives in {@code TestCoordinator} in the datastream-server-restli module. | ||
| */ | ||
| @Test | ||
| public class TestCoordinatorStandalone { | ||
|
|
||
| private static Datastream datastreamWithValidationTime(String createValidationTimeMs) { | ||
| Datastream ds = new Datastream(); | ||
| StringMap metadata = new StringMap(); | ||
| if (createValidationTimeMs != null) { | ||
| metadata.put(CREATE_VALIDATION_TIME_MS, createValidationTimeMs); | ||
| } | ||
| ds.setMetadata(metadata); | ||
| return ds; | ||
| } | ||
|
|
||
| @Test | ||
| public void testGetCreateValidationTimeMsPresent() { | ||
| // Present and positive -> included as-is | ||
| Assert.assertEquals(Coordinator.getCreateValidationTimeMs(datastreamWithValidationTime("1500")), 1500L); | ||
| } | ||
|
|
||
| @Test | ||
| public void testGetCreateValidationTimeMsAbsent() { | ||
| // Property not set -> excluded (0) | ||
| Assert.assertEquals(Coordinator.getCreateValidationTimeMs(datastreamWithValidationTime(null)), 0L); | ||
| } | ||
|
|
||
| @Test | ||
| public void testGetCreateValidationTimeMsNonPositive() { | ||
| // Zero or negative -> excluded (0) | ||
| Assert.assertEquals(Coordinator.getCreateValidationTimeMs(datastreamWithValidationTime("0")), 0L); | ||
| Assert.assertEquals(Coordinator.getCreateValidationTimeMs(datastreamWithValidationTime("-5")), 0L); | ||
| } | ||
|
|
||
| @Test | ||
| public void testGetCreateValidationTimeMsMalformed() { | ||
| // Not a valid long -> excluded (0) | ||
| Assert.assertEquals(Coordinator.getCreateValidationTimeMs(datastreamWithValidationTime("not-a-number")), 0L); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be good to log all the details - validation time, creation time and total?