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

[OPIK-529] Add error_info to spans and traces #885

Conversation

BorisTkachenko
Copy link
Contributor

Details

Add error_info to spans and traces

Testing

Covered by existing tests

@BorisTkachenko BorisTkachenko self-assigned this Dec 12, 2024
@BorisTkachenko BorisTkachenko requested a review from a team as a code owner December 12, 2024 15:28
Copy link
Collaborator

@andrescrz andrescrz left a comment

Choose a reason for hiding this comment

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

Let's review the DAO write and read paths per my open comments.

@@ -732,6 +751,8 @@ private Publisher<? extends Result> insert(List<Span> spans, Connection connecti
.bind("total_estimated_cost_version" + i,
estimatedCost.compareTo(BigDecimal.ZERO) > 0 ? ESTIMATED_COST_VERSION : "")
.bind("tags" + i, span.tags() != null ? span.tags().toArray(String[]::new) : new String[]{})
.bind("error_info" + i,
span.errorInfo() != null ? JsonUtils.readTree(span.errorInfo()).toString() : "")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure why you need the readTree call here in the write path. It should be enough to just write the errorInfo record.

There are multiple occurrences of this below in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ErrorInfo is a record with fixed fields, it's not a JsonNode, so if I write it without JsonUtils, it will be something like this in DB:

ErrorInfo[exceptionType=V_7ivWNh_f, message=zXvv1lMJwe, traceback=M3ZVOqxH0Y]

Then it would be impossible to deserialize and all Clickhouse Json related functions won't work as well.

I chose record Object instead of JsonNode since it will have fixed fileds, not arbitrary Json as metadata.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrescrz we could use here JsonUtils.writeValueAsString instead if you prefer

Copy link
Collaborator

Choose a reason for hiding this comment

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

After thinking about it twice, I think the most similar approach to other existing Json fields is to convert it to a JsonNode as you're doing. So this is fine.

andrescrz
andrescrz previously approved these changes Dec 13, 2024
Copy link
Collaborator

@andrescrz andrescrz left a comment

Choose a reason for hiding this comment

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

Doubt solved and just a minor suggestion. This is good to go.

@@ -732,6 +751,8 @@ private Publisher<? extends Result> insert(List<Span> spans, Connection connecti
.bind("total_estimated_cost_version" + i,
estimatedCost.compareTo(BigDecimal.ZERO) > 0 ? ESTIMATED_COST_VERSION : "")
.bind("tags" + i, span.tags() != null ? span.tags().toArray(String[]::new) : new String[]{})
.bind("error_info" + i,
span.errorInfo() != null ? JsonUtils.readTree(span.errorInfo()).toString() : "")
Copy link
Collaborator

Choose a reason for hiding this comment

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

After thinking about it twice, I think the most similar approach to other existing Json fields is to convert it to a JsonNode as you're doing. So this is fine.

@BorisTkachenko BorisTkachenko merged commit 40a5901 into main Dec 13, 2024
7 checks passed
@BorisTkachenko BorisTkachenko deleted the boryst/OPIK-529-error-tracking-be-add-new-error-info-field-to-span-and-trace-models branch December 13, 2024 14:31
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.

2 participants