Skip to content

Commit df90754

Browse files
thiagohoraclaude
andcommitted
[OPIK-7396] [BE] Address review: @VisibleForTesting + log values at end
- Annotate firstOrLogFanOut with @VisibleForTesting (it exists for the unit test). - Move the interpolated values to the end of the fan-out WARN (grep/service convention). Kept collectList(): SELECT_BY_IDS now collapses experiments_agg to one row per id, so the reducer buffers at most one row; it remains only as a defensive fan-out detector. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 409a264 commit df90754

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • apps/opik-backend/src/main/java/com/comet/opik/domain

apps/opik-backend/src/main/java/com/comet/opik/domain/TraceDAO.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.comet.opik.utils.template.TemplateUtils;
3434
import com.fasterxml.jackson.databind.JsonNode;
3535
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
36+
import com.google.common.annotations.VisibleForTesting;
3637
import com.google.common.base.Preconditions;
3738
import com.google.inject.ImplementedBy;
3839
import io.opentelemetry.instrumentation.annotations.WithSpan;
@@ -3470,10 +3471,11 @@ public Mono<Trace> findById(@NonNull UUID id, @NonNull Connection connection) {
34703471
* than one item") that a strict single-item reducer throws, which surfaces as a 500. The empty
34713472
* case is preserved (-> 404). A fan-out is logged so the underlying duplication stays visible.
34723473
*/
3474+
@VisibleForTesting
34733475
static Optional<Trace> firstOrLogFanOut(@NonNull List<Trace> traces, UUID id, String workspaceId) {
34743476
if (traces.size() > 1) {
3475-
log.warn("Trace id '{}' in workspace '{}' resolved to '{}' rows; returning the first",
3476-
id, workspaceId, traces.size());
3477+
log.warn("Trace get-by-id resolved to multiple rows; returning the first. workspaceId '{}', traceId '{}'",
3478+
workspaceId, id);
34773479
}
34783480
return traces.stream().findFirst();
34793481
}

0 commit comments

Comments
 (0)