Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
/**
* Base interface for all data source clients. This interface serves as a marker interface for all
* client implementations.
*
* @opensearch.experimental
*/
public interface DataSourceClient {}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
import org.opensearch.sql.datasource.model.DataSourceType;
import org.opensearch.sql.prometheus.utils.PrometheusClientUtils;

/** Factory for creating data source clients based on the data source type. */
/**
* Factory for creating data source clients based on the data source type.
*
* @opensearch.experimental
*/
public class DataSourceClientFactory {

private static final Logger LOG = LogManager.getLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

package org.opensearch.sql.datasource.client.exceptions;

/** Exception thrown when there are issues with data source client operations. */
/**
* Exception thrown when there are issues with data source client operations.
*
* @opensearch.experimental
*/
public class DataSourceClientException extends RuntimeException {

public DataSourceClientException(String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* Interface for handling queries for specific data source types.
*
* @param <T> The client type this handler works with, extending DataSourceClient
*
* @opensearch.experimental
*/
public interface QueryHandler<T extends DataSourceClient> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
import org.opensearch.common.inject.Inject;
import org.opensearch.sql.datasource.client.DataSourceClient;

/** Registry for all query handlers. */
/**
* Registry for all query handlers.
*
* @opensearch.experimental
*/
public class QueryHandlerRegistry {

private final List<QueryHandler<?>> handlers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import org.opensearch.sql.directquery.rest.model.GetDirectQueryResourcesRequest;
import org.opensearch.sql.directquery.rest.model.GetDirectQueryResourcesResponse;

/*
* @opensearch.experimental
*/
public interface DirectQueryExecutorService {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import org.opensearch.sql.directquery.rest.model.GetDirectQueryResourcesRequest;
import org.opensearch.sql.directquery.rest.model.GetDirectQueryResourcesResponse;

/*
* @opensearch.experimental
*/
public class DirectQueryExecutorServiceImpl implements DirectQueryExecutorService {

private final DataSourceClientFactory dataSourceClientFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@

package org.opensearch.sql.directquery.model;

/** Interface for data source specific options. */
/**
* Interface for data source specific options.
*
* @opensearch.experimental
*/
public interface DataSourceOptions {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

package org.opensearch.sql.directquery.rest.model;

/** Enum representing the types of resources that can be queried. */
/**
* Enum representing the types of resources that can be queried.
*
* @opensearch.experimental
*/
public enum DirectQueryResourceType {
UNKNOWN,
LABELS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

@Data
@NoArgsConstructor
/*
* @opensearch.experimental
*/
Comment on lines 16 to +20
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Place the comment before any annotations. Same as the rest.

Copy link
Collaborator

Choose a reason for hiding this comment

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

^ this seems like something spotless should be able to check/apply, if it's important let's make an issue for that.

public class ExecuteDirectQueryRequest {
// Required fields
private String dataSources; // Required: From URI path parameter or request body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import lombok.Data;
import lombok.NoArgsConstructor;

/*
* @opensearch.experimental
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import lombok.Data;
import lombok.NoArgsConstructor;

/*
* @opensearch.experimental
*/
@Data
@NoArgsConstructor
public class GetDirectQueryResourcesRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
/*
* @opensearch.experimental
*/
public class GetDirectQueryResourcesResponse<T> {
private T data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import org.opensearch.sql.prometheus.model.PrometheusQueryType;
import org.opensearch.sql.spark.rest.model.LangType;

/*
* @opensearch.experimental
*/
public class DirectQueryRequestValidator {
private DirectQueryRequestValidator() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import org.opensearch.sql.datasource.client.DataSourceClient;
import org.opensearch.sql.prometheus.model.MetricMetadata;

/*
* @opensearch.experimental
*/
public interface PrometheusClient extends DataSourceClient {

JSONObject queryRange(String query, Long start, Long end, String step) throws IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import org.json.JSONObject;
import org.opensearch.sql.prometheus.model.MetricMetadata;

/*
* @opensearch.experimental
*/
public class PrometheusClientImpl implements PrometheusClient {

private static final Logger logger = LogManager.getLogger(PrometheusClientImpl.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import org.opensearch.sql.datasource.client.exceptions.DataSourceClientException;

/** PrometheusClientException. */
/*
* @opensearch.experimental
*/
public class PrometheusClientException extends DataSourceClientException {
public PrometheusClientException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
@NoArgsConstructor
@EqualsAndHashCode
@JsonIgnoreProperties(ignoreUnknown = true)
/*
* @opensearch.experimental
*/
public class MetricMetadata {
private String type;
private String help;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
/** Prometheus-specific options for direct queries. */
@Data
@NoArgsConstructor
/*
* @opensearch.experimental
*/
public class PrometheusOptions implements DataSourceOptions {
private PrometheusQueryType queryType;
private String step; // Duration string in seconds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

/** Enum representing the types of Prometheus queries. */
@Getter
/*
* @opensearch.experimental
*/
public enum PrometheusQueryType {
INSTANT("instant"),
RANGE("range");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
import org.opensearch.sql.prometheus.model.PrometheusOptions;
import org.opensearch.sql.prometheus.model.PrometheusQueryType;

/*
* @opensearch.experimental
*/
public class PrometheusQueryHandler implements QueryHandler<PrometheusClient> {
private static final Logger LOG = LogManager.getLogger(PrometheusQueryHandler.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import org.opensearch.sql.prometheus.client.PrometheusClient;
import org.opensearch.sql.prometheus.client.PrometheusClientImpl;

/*
* @opensearch.experimental
*/
public class PrometheusClientUtils {
private PrometheusClientUtils() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import org.opensearch.sql.prometheus.client.PrometheusClient;
import org.opensearch.sql.prometheus.utils.PrometheusClientUtils;

/*
* @opensearch.experimental
*/
@RunWith(MockitoJUnitRunner.class)
public class DataSourceClientFactoryTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import org.mockito.junit.jupiter.MockitoExtension;
import org.opensearch.sql.datasource.client.DataSourceClient;

/*
* @opensearch.experimental
*/
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
@ExtendWith(MockitoExtension.class)
public class QueryHandlerRegistryTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
import org.opensearch.sql.prometheus.model.PrometheusQueryType;
import org.opensearch.sql.spark.rest.model.LangType;

/*
* @opensearch.experimental
*/
@ExtendWith(MockitoExtension.class)
public class DirectQueryExecutorServiceImplTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import org.opensearch.sql.prometheus.model.PrometheusQueryType;
import org.opensearch.sql.spark.rest.model.LangType;

/*
* @opensearch.experimental
*/
public class DirectQueryRequestValidatorTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
import org.junit.jupiter.api.Test;
import org.opensearch.sql.prometheus.exception.PrometheusClientException;

/*
* @opensearch.experimental
*/
public class PrometheusClientImplTest {

private MockWebServer mockWebServer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
import org.opensearch.sql.prometheus.model.PrometheusOptions;
import org.opensearch.sql.prometheus.model.PrometheusQueryType;

/*
* @opensearch.experimental
*/
@RunWith(MockitoJUnitRunner.class)
public class PrometheusQueryHandlerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
import org.opensearch.sql.datasource.model.DataSourceMetadata;
import org.opensearch.sql.prometheus.client.PrometheusClient;

/*
* @opensearch.experimental
*/
@RunWith(MockitoJUnitRunner.class)
public class PrometheusClientUtilsTest {

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

package org.opensearch.sql.prometheus.constant;

/*
* @opensearch.experimental
*/
public class TestConstants {
public static final String QUERY = "test_query";
public static final Long STARTTIME = 1664767694133L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import java.io.IOException;
import java.util.Objects;

/*
* @opensearch.experimental
*/
public class TestUtils {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.OpenSearchException;
import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.core.action.ActionListener;
import org.opensearch.core.rest.RestStatus;
import org.opensearch.rest.BaseRestHandler;
Expand All @@ -39,6 +40,10 @@
import org.opensearch.sql.protocol.response.format.JsonResponseFormatter;
import org.opensearch.transport.client.node.NodeClient;

/*
* @opensearch.experimental
*/
@ExperimentalApi
@RequiredArgsConstructor
public class RestDirectQueryManagementAction extends BaseRestHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.OpenSearchException;
import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.core.action.ActionListener;
import org.opensearch.core.rest.RestStatus;
import org.opensearch.rest.BaseRestHandler;
Expand All @@ -35,6 +36,10 @@
import org.opensearch.sql.opensearch.util.RestRequestUtil;
import org.opensearch.transport.client.node.NodeClient;

/*
* @opensearch.experimental
*/
@ExperimentalApi
@RequiredArgsConstructor
public class RestDirectQueryResourcesManagementAction extends BaseRestHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import org.opensearch.tasks.Task;
import org.opensearch.transport.TransportService;

/*
* @opensearch.experimental
*/
public class TransportExecuteDirectQueryRequestAction
extends HandledTransportAction<
ExecuteDirectQueryActionRequest, ExecuteDirectQueryActionResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import org.opensearch.tasks.Task;
import org.opensearch.transport.TransportService;

/*
* @opensearch.experimental
*/
public class TransportGetDirectQueryResourcesRequestAction
extends HandledTransportAction<
GetDirectQueryResourcesActionRequest, GetDirectQueryResourcesActionResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import org.opensearch.sql.directquery.DirectQueryExecutorServiceImpl;
import org.opensearch.sql.prometheus.query.PrometheusQueryHandler;

/*
* @opensearch.experimental
*/
public class DirectQueryModule extends AbstractModule {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import org.opensearch.sql.spark.rest.model.LangType;

@UtilityClass
/*
* @opensearch.experimental
*/
public class DirectQueryRequestConverter {

public static ExecuteDirectQueryRequest fromXContentParser(XContentParser parser)
Expand Down
Loading
Loading