Skip to content

Adds graph build time metrics in NativeEngines990KnnVectorsWriter#2018

Merged
heemin32 merged 1 commit intoopensearch-project:mainfrom
shatejas:native-metric
Sep 3, 2024
Merged

Adds graph build time metrics in NativeEngines990KnnVectorsWriter#2018
heemin32 merged 1 commit intoopensearch-project:mainfrom
shatejas:native-metric

Conversation

@shatejas
Copy link
Collaborator

Description

Adds graph build time. This was missed in the initial PR

Related Issues

Check List

  • New functionality includes testing.
  • Commits are signed per the DCO using --signoff.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

navneet1v
navneet1v previously approved these changes Sep 3, 2024
Copy link
Collaborator

@navneet1v navneet1v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the change. But I do believe this function: trainAndIndex is becoming hard to extend. @Vikasht34 lets do some refactoring on this after the freeze.

indexOperation.buildAndWrite(writer, knnVectorValues);
long time_in_millis = stopWatch.totalTime().millis();
graphBuildTime.set(graphBuildTime.getValue() + time_in_millis);
log.warn("Graph build took " + time_in_millis + " ms for " + operationName);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we publishing this as warn level but not info level?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its maintaining the status quo

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that status quo is not correct.

flatVectorsWriter.mergeOneField(fieldInfo, mergeState);
// For merge, pick values from flat vector and reindex again. This will use the flush operation to create graphs
trainAndIndex(fieldInfo, this::getKNNVectorValuesForMerge, NativeIndexWriter::mergeIndex, mergeState);
trainAndIndex(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a unit test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class seems to only have a component test. Will try to cover it in the existing component test and create an issue to add unit test around this so it can be taken as a follow up

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heemin32 do we need UTs to check if the log is coming?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not about logging but about adding build time in metrics.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class seems to only have a component test. Will try to cover it in the existing component test and create an issue to add unit test around this so it can be taken as a follow up

I believe, all these static method is making it harder to write a unit test. I wish we can rely more on dependency injection using Guice.

Copy link
Collaborator

@navneet1v navneet1v Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe, all these static method is making it harder to write a unit test. I wish we can rely more on dependency injection using Guice.

if we want to make these things work via DI then its a change which is out of scope of this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know. Just sharing my long term desire and testing the water :)

Signed-off-by: Tejas Shah <shatejas@amazon.com>
@heemin32 heemin32 merged commit e6c5953 into opensearch-project:main Sep 3, 2024
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 3, 2024
)

Signed-off-by: Tejas Shah <shatejas@amazon.com>
(cherry picked from commit e6c5953)
navneet1v pushed a commit that referenced this pull request Sep 4, 2024
) (#2022)

Signed-off-by: Tejas Shah <shatejas@amazon.com>
(cherry picked from commit e6c5953)

Co-authored-by: Tejas Shah <shatejas@amazon.com>
opensearch-trigger-bot bot added a commit that referenced this pull request Sep 4, 2024
) (#2022)

Signed-off-by: Tejas Shah <shatejas@amazon.com>
(cherry picked from commit e6c5953)

Co-authored-by: Tejas Shah <shatejas@amazon.com>
(cherry picked from commit b04bb3a)
ryanbogan pushed a commit that referenced this pull request Sep 4, 2024
) (#2022) (#2030)

Signed-off-by: Tejas Shah <shatejas@amazon.com>
(cherry picked from commit e6c5953)

Co-authored-by: Tejas Shah <shatejas@amazon.com>
(cherry picked from commit b04bb3a)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
@shatejas shatejas deleted the native-metric branch September 13, 2024 18:46
akashsha1 pushed a commit to akashsha1/k-NN that referenced this pull request Sep 16, 2024
…ensearch-project#2018)

Signed-off-by: Tejas Shah <shatejas@amazon.com>
Signed-off-by: Akash Shankaran <akash.shankaran@intel.com>
jingqimao77-spec pushed a commit to jingqimao77-spec/k-NN that referenced this pull request Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants