-
Notifications
You must be signed in to change notification settings - Fork 131
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-75: Add batch spans creation endpoint #205
Conversation
9910e26
to
05028fd
Compare
05028fd
to
3b68fd1
Compare
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.
Discussed offline, but we should probably:
- Remove the merge code all-together.
- Let's move compression to a separated improvement.
After that, a lot of smaller comments.
apps/opik-backend/src/main/java/com/comet/opik/api/SpanBatch.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanDAO.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanDAO.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanDAO.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanDAO.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanDAO.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanDAO.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanService.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/utils/JsonUtils.java
Outdated
Show resolved
Hide resolved
bee108a
to
e03b560
Compare
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.
Let's keep removing unnecessary stuff from the PR and polish a few more details.
This is generally in the good direction.
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanDAO.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanService.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanService.java
Outdated
Show resolved
Hide resolved
.toList(); | ||
} | ||
|
||
private Mono<Project> resolveProject(String projectName) { |
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.
I believe a method already exists in this service for this. Let's avoid the duplication if possible.
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.
This method is already reusing the create logic. We check if it's empty
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.
Minor: looking at the latest code, this extra method isn't doing much , you can clean it up and just directly call
getOrCreateProject(WorkspaceUtils.getProjectName(projectName))
apps/opik-backend/src/main/java/com/comet/opik/domain/SpanService.java
Outdated
Show resolved
Hide resolved
apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/SpansResourceTest.java
Show resolved
Hide resolved
3fcfbdd
to
c6b6d46
Compare
c6b6d46
to
9735090
Compare
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.
LGTM, just a few more minor comments about stylish things for the future.
Thanks for putting this together!
:name<item.index>, | ||
:type<item.index>, | ||
parseDateTime64BestEffort(:start_time<item.index>, 9), | ||
if(:end_time<item.index> IS NULL, NULL, parseDateTime64BestEffort(:end_time<item.index>, 9)), |
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.
Minor: there's also a parseDateTimeBestEffortUSOrNull
function:
public Mono<Long> batchInsert(@NonNull List<Span> spans) { | ||
|
||
Preconditions.checkArgument(!spans.isEmpty(), "Spans list must not be empty"); |
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.
Minor: alternatively, you can remove the @NonNull
annotation and do both checks in one go with CollectionUtils.isNotEmpty
.
public Mono<Long> create(@NonNull SpanBatch batch) { | ||
|
||
Preconditions.checkArgument(!batch.spans().isEmpty(), "Batch spans must not be empty"); |
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.
Same.
.toList(); | ||
} | ||
|
||
private Mono<Project> resolveProject(String projectName) { |
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.
Minor: looking at the latest code, this extra method isn't doing much , you can clean it up and just directly call
getOrCreateProject(WorkspaceUtils.getProjectName(projectName))
Details
Add endpoint to batch create spans.
POST /v1/private/spans/batch
Issues
Resolves #OPIK-75
Testing
Documentation