Skip to content
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

[Tracing Instrumentation] Fix for null connection test cases #10410

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Gaganjuneja
Copy link
Contributor

@Gaganjuneja Gaganjuneja commented Oct 5, 2023

Description

Anomaly-detection has some test cases which passes null connection and those are getting NullPointerException which was earlier handled by the listener. Adding the null connection check in the SpanName builder.

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)
  • GitHub issue/PR created in OpenSearch documentation repo for the required public documentation changes (#[Issue/PR number])

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.

@Gaganjuneja
Copy link
Contributor Author

@reta, Please take a look, Its breaking the Anomaly detection plugin's build.

@Gaganjuneja Gaganjuneja changed the title Fix for null connection test cases [Tracing Instrumentation] Fix for null connection test cases Oct 5, 2023
Signed-off-by: Gagan Juneja <[email protected]>
@msfroh
Copy link
Collaborator

msfroh commented Oct 5, 2023

@Gaganjuneja -- Do you think it makes sense to fix it this way, or should AD just not pass a null connection?

@Gaganjuneja
Copy link
Contributor Author

@Gaganjuneja -- Do you think it makes sense to fix it this way, or should AD just not pass a null connection?

Ideally yes AD shouldn't pass the null connection but may be there are some test cases which may want to test if their listener::handleException gets called if the connection is null. I guess there is no harm putting up this additional check. What's your thought on this?

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

Compatibility status:

Checks if related components are compatible with change 17f2952

Incompatible components

Incompatible components: [https://github.com/opensearch-project/custom-codecs.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/flow-framework.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/performance-analyzer.git]

Skipped components

Compatible components

Compatible components: [https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/sql.git]

@Gaganjuneja
Copy link
Contributor Author

I don't object to the null-check, but on the other hand, part of me likes the idea that the possible NPE highlights other misconfigured things.

💯

Totally agreed, In case needed please feel free to merge this PR :)

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

Gradle Check (Jenkins) Run Completed with:

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Nov 5, 2023
@ticheng-aws
Copy link
Contributor

Hi @Gaganjuneja, Is this being worked upon? Feel free to reach out to maintainers for further reviews.

@opensearch-trigger-bot opensearch-trigger-bot bot removed the stalled Issues that have stalled label Jan 8, 2024
@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Feb 11, 2024
@sohami
Copy link
Collaborator

sohami commented Feb 14, 2024

Looking into the code around this area, seems like connection is always expected to be non-null (Ref here). So probably adding a check Objects.nonNull(connection, "Input connection is expected to be non-null" ) in the createSpanName would help to catch such issues (mostly occurring in tests). Currently the PR is ignoring the null connection and expecting the lower layer to handle it or throw the error. Thoughts ?

@reta
Copy link
Collaborator

reta commented Feb 14, 2024

Looking into the code around this area, seems like connection is always expected to be non-null (Ref here).

The connection should never be null indeed

@Gaganjuneja
Copy link
Contributor Author

Looking into the code around this area, seems like connection is always expected to be non-null (Ref here).

The connection should never be null indeed

+1, This was coming null from test cases.

@opensearch-trigger-bot opensearch-trigger-bot bot removed the stalled Issues that have stalled label Feb 16, 2024
@dblock
Copy link
Member

dblock commented Feb 27, 2024

@Gaganjuneja what do you want to do with this?

If this can't be null maybe the right thing to do is an assert. Otherwise add a test case for the null scenario.

@Gaganjuneja
Copy link
Contributor Author

I am closing this PR. This is not needed as fixed in the AD plugin.

@Gaganjuneja Gaganjuneja closed this Mar 1, 2024
@dblock
Copy link
Member

dblock commented Mar 1, 2024

@Gaganjuneja I think this was a valid case though, being defensive in this code was a good idea. Consider finishing it?

@Gaganjuneja
Copy link
Contributor Author

Sure, will cleanup the code. Thanks @dblock

Copy link
Contributor

❌ Gradle check result for 17f2952: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Apr 11, 2024
@mgodwan
Copy link
Member

mgodwan commented Apr 23, 2024

@Gaganjuneja Are you planning to continue on this PR and targeting any upcoming release?
This has been stalled now, and if this is not planned to be continued, lets close this.

@opensearch-trigger-bot opensearch-trigger-bot bot removed the stalled Issues that have stalled label Apr 24, 2024
@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stalled Issues that have stalled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants