Skip to content

Conversation

chriswlai
Copy link

@chriswlai chriswlai commented Jul 25, 2025

Description

Adds tracing to all CRUD operations of the connector component as well as model prediction and execution.

Related Issues

Resolves #3971

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 20:51 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 20:51 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 20:51 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 20:51 — with GitHub Actions Failure
@chriswlai chriswlai force-pushed the feature/conntracer branch from 22b888d to 2ddfc2d Compare July 25, 2025 21:11
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 21:13 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 21:13 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 21:13 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 21:13 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 22:12 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 22:12 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 22:12 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval July 25, 2025 22:12 — with GitHub Actions Failure
@chriswlai chriswlai temporarily deployed to ml-commons-cicd-env-require-approval July 29, 2025 18:37 — with GitHub Actions Inactive
@chriswlai chriswlai temporarily deployed to ml-commons-cicd-env-require-approval July 29, 2025 18:37 — with GitHub Actions Inactive
@chriswlai chriswlai temporarily deployed to ml-commons-cicd-env-require-approval July 29, 2025 18:37 — with GitHub Actions Inactive
@chriswlai chriswlai temporarily deployed to ml-commons-cicd-env-require-approval July 29, 2025 18:37 — with GitHub Actions Inactive
@@ -0,0 +1,175 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

we don't need this anymore?

@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 20:11 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 20:11 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 20:11 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 20:11 — with GitHub Actions Failure
Signed-off-by: chrislai <chrlaii@amazon.com>
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 21:22 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 21:22 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 21:22 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 21:22 — with GitHub Actions Failure
Signed-off-by: chrislai <chrlaii@amazon.com>
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 21:26 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 21:26 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 21:26 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 21:26 — with GitHub Actions Failure
Copy link
Collaborator

@pyek-bot pyek-bot left a comment

Choose a reason for hiding this comment

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

Changes look good, left a few comments

Comment on lines +135 to +137
MLConnectorTracer.resetForTest();
MLConnectorTracer.initialize(NoopTracer.INSTANCE, mlFeatureEnabledSetting);

Copy link
Collaborator

Choose a reason for hiding this comment

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

is this used?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it is required to avoid IllegalStateException from MLConnectorTracer.getInstance calls

Copy link
Collaborator

Choose a reason for hiding this comment

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

But in this file I don't see any usage of this tracer?

* </ul>
*/
@Log4j2
public class MLConnectorTracer extends MLTracer {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it possible to separate MLConnectorTracer and MLModelTracer?

Copy link
Author

Choose a reason for hiding this comment

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

MLModelTracer added

Comment on lines +187 to +191
public static void handleSpanError(Span span, String errorMessage, Exception e) {
log.error(errorMessage, e);
span.setError(e);
getInstance().endSpan(span);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: i see lot of these methods handleSpanError() and they do the same thing, do u think it's possible to move this to the MLTracer itself?

Copy link
Author

Choose a reason for hiding this comment

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

Unfortunately no, since getInstance only exists in specific classes (MLAgentTracer / MLConnectorTracer) so the method can't be moved to MLTracer

RestStatus.FORBIDDEN
)
);
predictSpan.setError(e);
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this need to be set before the listener.onFailure()?

Copy link
Author

Choose a reason for hiding this comment

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

Good catch! addressed

Signed-off-by: chrislai <chrlaii@amazon.com>
@chriswlai chriswlai changed the title Connector Tracing Connector and Model Tracing Aug 6, 2025
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 23:15 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 23:15 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 23:15 — with GitHub Actions Error
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 23:15 — with GitHub Actions Error
Signed-off-by: chrislai <chrlaii@amazon.com>
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 23:21 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 23:21 — with GitHub Actions Failure
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 23:21 — with GitHub Actions Error
@chriswlai chriswlai had a problem deploying to ml-commons-cicd-env-require-approval August 6, 2025 23:21 — with GitHub Actions Error
* If null, tracing will be disabled.
*/
public static synchronized void initialize(Tracer tracer, MLFeatureEnabledSetting mlFeatureEnabledSetting) {
initialize(tracer, mlFeatureEnabledSetting, null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this ever null?

Copy link
Collaborator

@pyek-bot pyek-bot left a comment

Choose a reason for hiding this comment

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

LGTM

@mingshl mingshl merged commit d7d0781 into opensearch-project:feature/agent-tracing Aug 7, 2025
6 of 10 checks passed
chriswlai added a commit to chriswlai/ml-commons that referenced this pull request Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants