Skip to content

Commit

Permalink
NO-JIRA Missing now64 precision of 9 (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrescrz authored Sep 10, 2024
1 parent 4fd6400 commit ef4c23d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.comet.opik.domain;

import com.comet.opik.api.DatasetItem;
import com.comet.opik.api.DatasetItemBatch;
import com.comet.opik.api.DatasetItemSearchCriteria;
import com.comet.opik.api.DatasetItemSource;
import com.comet.opik.api.ExperimentItem;
Expand Down Expand Up @@ -348,10 +347,12 @@ public Mono<Long> save(@NonNull UUID datasetId, @NonNull List<DatasetItem> items
return Mono.empty();
}

return asyncTemplate.nonTransaction(connection -> mapAndInsert(datasetId, items, connection, INSERT_DATASET_ITEM));
return asyncTemplate.nonTransaction(connection -> mapAndInsert(
datasetId, items, connection, INSERT_DATASET_ITEM));
}

private Mono<Long> mapAndInsert(UUID datasetId, List<DatasetItem> items, Connection connection, String sqlTemplate) {
private Mono<Long> mapAndInsert(
UUID datasetId, List<DatasetItem> items, Connection connection, String sqlTemplate) {

List<QueryItem> queryItems = getQueryItemPlaceHolder(items.size());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public Mono<Long> insert(@NonNull Set<ExperimentItem> experimentItems) {
}

return Mono.from(connectionFactory.create())
.flatMap(connection -> insert(experimentItems, connection));
.flatMap(connection -> insert(experimentItems, connection));
}

private Mono<Long> insert(Collection<ExperimentItem> experimentItems, Connection connection) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.comet.opik.domain;

import com.clickhouse.client.ClickHouseException;
import com.comet.opik.api.ExperimentItem;
import com.comet.opik.infrastructure.auth.RequestContext;
import com.google.common.base.Preconditions;
Expand Down Expand Up @@ -100,7 +99,8 @@ private Mono<Boolean> validateDatasetItemWorkspace(String workspaceId, Set<UUID>
}

return datasetItemDAO.getDatasetItemWorkspace(datasetItemIds)
.map(datasetItemWorkspace -> datasetItemWorkspace.stream().allMatch(datasetItem -> workspaceId.equals(datasetItem.workspaceId())));
.map(datasetItemWorkspace -> datasetItemWorkspace.stream()
.allMatch(datasetItem -> workspaceId.equals(datasetItem.workspaceId())));
}

public Mono<ExperimentItem> get(@NonNull UUID id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import lombok.extern.slf4j.Slf4j;
import org.reactivestreams.Publisher;
import org.stringtemplate.v4.ST;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.time.Instant;
Expand Down Expand Up @@ -155,7 +154,7 @@ INSERT INTO spans(
:metadata as metadata,
:tags as tags,
mapFromArrays(:usage_keys, :usage_values) as usage,
now64() as created_at,
now64(9) as created_at,
:user_name as created_by,
:user_name as last_updated_by
) as new_span
Expand Down Expand Up @@ -326,7 +325,7 @@ INSERT INTO spans(
<if(metadata)> :metadata <else> '' <endif> as metadata,
<if(tags)> :tags <else> [] <endif> as tags,
<if(usage)> CAST((:usageKeys, :usageValues), 'Map(String, Int64)') <else> mapFromArrays([], []) <endif> as usage,
now64() as created_at,
now64(9) as created_at,
:user_name as created_by,
:user_name as last_updated_by
) as new_span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,9 @@ private void bindSearchCriteria(TraceSearchCriteria traceSearchCriteria, Stateme

@Override
@com.newrelic.api.agent.Trace(dispatcher = true)
public Mono<List<WorkspaceAndResourceId>> getTraceWorkspace(@NonNull Set<UUID> traceIds, @NonNull Connection connection) {

public Mono<List<WorkspaceAndResourceId>> getTraceWorkspace(
@NonNull Set<UUID> traceIds, @NonNull Connection connection) {

if (traceIds.isEmpty()) {
return Mono.just(List.of());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ public Mono<Boolean> validateTraceWorkspace(@NonNull String workspaceId, @NonNul
}

return template.nonTransaction(connection -> dao.getTraceWorkspace(traceIds, connection)
.map(traceWorkspace -> traceWorkspace.stream().allMatch(trace -> workspaceId.equals(trace.workspaceId()))));
.map(traceWorkspace -> traceWorkspace.stream()
.allMatch(trace -> workspaceId.equals(trace.workspaceId()))));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import jakarta.inject.Named;
import jakarta.inject.Singleton;
import ru.vyarus.dropwizard.guice.module.support.DropwizardAwareModule;
import ru.vyarus.dropwizard.guice.module.yaml.bind.Config;

public class DatabaseAnalyticsModule extends DropwizardAwareModule<OpikConfiguration> {

Expand Down

0 comments on commit ef4c23d

Please sign in to comment.