Skip to content

Commit

Permalink
merge up between components, metrics, and extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jshook committed Oct 6, 2023
2 parents b1cc0b2 + 3c3151c commit 0054ba3
Show file tree
Hide file tree
Showing 66 changed files with 568 additions and 1,165 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ jobs:
# name: codecov-report
# path: codecov-report.tgz

- name: Collecting logfiles
if: success() || failure()
run: tar -zcvf logfiles.tgz [a-zA-Z]**/logs/*
# - name: Collecting logfiles
# if: success() || failure()
# run: tar -zcvf logfiles.tgz [a-zA-Z]**/logs/*

- name: Uploading log files
if: success() || failure()
uses: actions/upload-artifact@v3
with:
node-version: '16'
name: nb-logs
path: logfiles.tgz
# - name: Uploading log files
# if: success() || failure()
# uses: actions/upload-artifact@v3
# with:
# node-version: '16'
# name: nb-logs
# path: logfiles.tgz

- name: export docs
if: success()
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ jobs:
# asset_name: nb5
# asset_content_type: application/octet-stream

- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: |
[a-zA-Z]**/logs/*
# - name: Archive Test Results
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: test-results
# path: |
# [a-zA-Z]**/logs/*

# This triggers a preview build by cascading the tag to the builddocs repo.
# The builddocs repo then pushes to preview or release depending on the tag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@
package io.nosqlbench.engine.extensions.vectormath;

import com.datastax.oss.driver.api.core.cql.Row;
import io.nosqlbench.components.NBBaseComponent;
import io.nosqlbench.components.NBComponent;

import java.util.List;
import java.util.Objects;

public class CqlUtils {
public class CqlUtils extends NBBaseComponent {

public CqlUtils(NBComponent parentComponent) {
super(parentComponent);
}

public static long[] cqlRowFieldsToLongArray(String fieldName, List<Row> rows) {
return rows.stream().mapToLong(r -> r.getLong(fieldName)).toArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package io.nosqlbench.engine.extensions.vectormath;

import com.codahale.metrics.MetricRegistry;
import io.nosqlbench.api.config.LabeledScenarioContext;
import io.nosqlbench.api.extensions.ScriptingExtensionPluginInfo;
import io.nosqlbench.components.NBComponent;
import io.nosqlbench.nb.annotations.Service;
import org.apache.logging.log4j.Logger;

Expand All @@ -30,7 +30,7 @@ public String getDescription() {
}

@Override
public CqlUtils getExtensionObject(Logger logger, MetricRegistry metricRegistry, LabeledScenarioContext scriptContext) {
return new CqlUtils();
public CqlUtils getExtensionObject(Logger logger, NBComponent baseComponent) {
return new CqlUtils(baseComponent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@
package io.nosqlbench.engine.extensions.vectormath;

import com.google.protobuf.Descriptors;
import io.nosqlbench.components.NBBaseComponent;
import io.nosqlbench.components.NBComponent;
import io.pinecone.proto.QueryResponse;
import io.pinecone.proto.ScoredVector;

public class PineconeScriptingUtils {
public class PineconeScriptingUtils extends NBBaseComponent {

public PineconeScriptingUtils(NBComponent parentComponent) {
super(parentComponent);
}

public String[] responseIdsToStringArray(QueryResponse response) {
return response.getMatchesList().stream().map(ScoredVector::getId).toArray(String[]::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

package io.nosqlbench.engine.extensions.vectormath;

import com.codahale.metrics.MetricRegistry;
import io.nosqlbench.api.config.LabeledScenarioContext;
import io.nosqlbench.api.extensions.ScriptingExtensionPluginInfo;
import io.nosqlbench.components.NBComponent;
import io.nosqlbench.nb.annotations.Service;
import org.apache.logging.log4j.Logger;

Expand All @@ -30,7 +29,7 @@ public String getDescription() {
}

@Override
public PineconeScriptingUtils getExtensionObject(Logger logger, MetricRegistry metricRegistry, LabeledScenarioContext scriptContext) {
return new PineconeScriptingUtils();
public PineconeScriptingUtils getExtensionObject(Logger logger, NBComponent baseComponent) {
return new PineconeScriptingUtils(baseComponent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import io.nosqlbench.components.NBBaseComponent;
import io.pinecone.proto.QueryResponse;
import io.pinecone.proto.ScoredVector;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -50,7 +51,7 @@ private QueryResponse generateQueryResponse() {
@Test
void responseIdsToStringArrayTest() {
QueryResponse response = generateQueryResponse();
PineconeScriptingUtils utils = new PineconeScriptingUtils();
PineconeScriptingUtils utils = new PineconeScriptingUtils(new NBBaseComponent(null));
String[] ids = utils.responseIdsToStringArray(response);
assert(ids.length == 3);
assert(ids[0].equals("1"));
Expand All @@ -61,7 +62,7 @@ void responseIdsToStringArrayTest() {
@Test
void responseIdsToIntArrayTest() {
QueryResponse response = generateQueryResponse();
PineconeScriptingUtils utils = new PineconeScriptingUtils();
PineconeScriptingUtils utils = new PineconeScriptingUtils(new NBBaseComponent(null));
int[] ids = utils.responseIdsToIntArray(response);
assert(ids.length == 3);
assert(ids[0] == 1);
Expand All @@ -72,7 +73,7 @@ void responseIdsToIntArrayTest() {
@Test
void responseIdsToLongArrayTest() {
QueryResponse response = generateQueryResponse();
PineconeScriptingUtils utils = new PineconeScriptingUtils();
PineconeScriptingUtils utils = new PineconeScriptingUtils(new NBBaseComponent(null));
long[] ids = utils.responseIdsToLongArray(response);
assert(ids.length == 3);
assert(ids[0] == 1L);
Expand All @@ -83,7 +84,7 @@ void responseIdsToLongArrayTest() {
@Test
void responseFieldToStringArrayTest() {
QueryResponse response = generateQueryResponse();
PineconeScriptingUtils utils = new PineconeScriptingUtils();
PineconeScriptingUtils utils = new PineconeScriptingUtils(new NBBaseComponent(null));
String[] ids = utils.responseFieldToStringArray("a", response);
assert(ids.length == 3);
assert(ids[0].equals("4"));
Expand All @@ -94,7 +95,7 @@ void responseFieldToStringArrayTest() {
@Test
void responseFieldToIntArrayTest() {
QueryResponse response = generateQueryResponse();
PineconeScriptingUtils utils = new PineconeScriptingUtils();
PineconeScriptingUtils utils = new PineconeScriptingUtils(new NBBaseComponent(null));
int[] ids = utils.responseFieldToIntArray("b", response);
assert(ids.length == 3);
assert(ids[0] == 5);
Expand All @@ -105,7 +106,7 @@ void responseFieldToIntArrayTest() {
@Test
void responseFieldToLongArrayTest() {
QueryResponse response = generateQueryResponse();
PineconeScriptingUtils utils = new PineconeScriptingUtils();
PineconeScriptingUtils utils = new PineconeScriptingUtils(new NBBaseComponent(null));
long[] ids = utils.responseFieldToLongArray("c", response);
assert(ids.length == 3);
assert(ids[0] == 6L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ private void addServices() {
LogManager.getLogger("extensions." + extensionDescriptor.getBaseVariableName());
final Object extensionObject = extensionDescriptor.getExtensionObject(
extensionLogger,
null,
null
);
logger.trace(() -> "Adding extension object: name=" + extensionDescriptor.getBaseVariableName() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.nosqlbench.api.engine.metrics.DeltaHdrHistogramReservoir;
import io.nosqlbench.api.engine.metrics.HistoIntervalLogger;
import io.nosqlbench.api.engine.metrics.instruments.NBMetricHistogram;
import io.nosqlbench.components.NBBaseComponent;
import org.HdrHistogram.EncodableHistogram;
import org.HdrHistogram.Histogram;
import org.HdrHistogram.HistogramLogReader;
Expand All @@ -41,7 +42,7 @@ public void testBasicLogger() throws IOException {
File tempFile = File.createTempFile("testhistointlog", "hdr", new File("/tmp"));
tempFile.deleteOnExit();

HistoIntervalLogger hil = new HistoIntervalLogger("loggertest", tempFile, Pattern.compile(".*"), 1000);
HistoIntervalLogger hil = new HistoIntervalLogger(new NBBaseComponent(null), "loggertest", tempFile, Pattern.compile(".*"), 1000);

final int significantDigits = 4;

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package io.nosqlbench.engine.extensions.computefunctions;

import com.codahale.metrics.MetricRegistry;
import io.nosqlbench.api.config.LabeledScenarioContext;
import io.nosqlbench.api.extensions.ScriptingExtensionPluginInfo;
import io.nosqlbench.components.NBComponent;
import io.nosqlbench.nb.annotations.Service;
import org.apache.logging.log4j.Logger;

Expand All @@ -32,8 +32,8 @@ public String getDescription() {
}

@Override
public ComputeFunctions getExtensionObject(Logger logger, MetricRegistry metricRegistry, LabeledScenarioContext scriptContext) {
return new ComputeFunctions();
public ComputeFunctions getExtensionObject(Logger logger, NBComponent baseComponent) {
return new ComputeFunctions(baseComponent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

package io.nosqlbench.engine.extensions.computefunctions;

import io.nosqlbench.components.NBBaseComponent;
import io.nosqlbench.components.NBComponent;

import java.util.Arrays;
import java.util.DoubleSummaryStatistics;
import java.util.HashSet;
Expand All @@ -39,7 +42,11 @@
* these methods will yield incorrect results as they rely on the <EM>two-pointer</EM> method and do not
* elide duplicates internally.
*/
public class ComputeFunctions {
public class ComputeFunctions extends NBBaseComponent {

public ComputeFunctions(NBComponent parentComponent) {
super(parentComponent);
}

/**
* Compute the recall as the proportion of matching indices divided by the expected indices
Expand Down

This file was deleted.

Loading

0 comments on commit 0054ba3

Please sign in to comment.