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 @@ -14,7 +14,6 @@
import static org.opensearch.dataprepper.plugins.source.otellogs.OTelLogsSourceConfig.DEFAULT_REQUEST_TIMEOUT_MS;
import static org.opensearch.dataprepper.plugins.source.otellogs.OtelLogsSourceConfigTestData.BASIC_AUTH_PASSWORD;
import static org.opensearch.dataprepper.plugins.source.otellogs.OtelLogsSourceConfigTestData.BASIC_AUTH_USERNAME;
import static org.opensearch.dataprepper.plugins.source.otellogs.OtelLogsSourceConfigTestData.CONFIG_HTTP_PATH;

import java.util.Map;

Expand Down Expand Up @@ -42,7 +41,6 @@ public static OTelLogsSourceConfig createDefaultConfig() {
public static OTelLogsSourceConfig.OTelLogsSourceConfigBuilder createDefaultConfigBuilder() {
return OTelLogsSourceConfig.builder()
.healthCheck(true)
.httpPath(CONFIG_HTTP_PATH)
.port(DEFAULT_PORT)
.enableUnframedRequests(false)
.ssl(false)
Expand Down
3 changes: 0 additions & 3 deletions data-prepper-plugins/otel-metrics-source/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies {
implementation project(':data-prepper-plugins:armeria-common')
implementation project(':data-prepper-plugins:otel-proto-common')
implementation project(':data-prepper-plugins:http-common')
implementation project(':data-prepper-plugins:http-source-common' )
testImplementation project(':data-prepper-api').sourceSets.test.output
implementation libs.opentelemetry.proto
implementation libs.commons.io
Expand All @@ -35,8 +34,6 @@ dependencies {
testImplementation 'org.assertj:assertj-core:3.27.7'
testImplementation libs.commons.io
testImplementation 'org.skyscreamer:jsonassert:1.5.3'
implementation 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'org.projectlombok:lombok:1.18.26'
}

jacocoTestCoverageVerification {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.opensearch.dataprepper.plugins.source.otelmetrics;

import org.opensearch.dataprepper.plugins.server.ServerConfiguration;

public class ConvertConfiguration {

public static ServerConfiguration convertConfiguration(final OTelMetricsSourceConfig oTelMetricsSourceConfig) {
ServerConfiguration serverConfiguration = new ServerConfiguration();
serverConfiguration.setPath(oTelMetricsSourceConfig.getPath());
serverConfiguration.setHealthCheck(oTelMetricsSourceConfig.hasHealthCheck());
serverConfiguration.setProtoReflectionService(oTelMetricsSourceConfig.hasProtoReflectionService());
serverConfiguration.setRequestTimeoutInMillis(oTelMetricsSourceConfig.getRequestTimeoutInMillis());
serverConfiguration.setEnableUnframedRequests(oTelMetricsSourceConfig.enableUnframedRequests());
serverConfiguration.setCompression(oTelMetricsSourceConfig.getCompression());
serverConfiguration.setAuthentication(oTelMetricsSourceConfig.getAuthentication());
serverConfiguration.setSsl(oTelMetricsSourceConfig.isSsl());
serverConfiguration.setUnauthenticatedHealthCheck(oTelMetricsSourceConfig.isUnauthenticatedHealthCheck());
serverConfiguration.setUseAcmCertForSSL(oTelMetricsSourceConfig.useAcmCertForSSL());
serverConfiguration.setMaxRequestLength(oTelMetricsSourceConfig.getMaxRequestLength());
serverConfiguration.setPort(oTelMetricsSourceConfig.getPort());
serverConfiguration.setRetryInfo(oTelMetricsSourceConfig.getRetryInfo());
serverConfiguration.setThreadCount(oTelMetricsSourceConfig.getThreadCount());
serverConfiguration.setMaxConnectionCount(oTelMetricsSourceConfig.getMaxConnectionCount());

return serverConfiguration;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/

package org.opensearch.dataprepper.plugins.source.otelmetrics;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/

package org.opensearch.dataprepper.plugins.source.otelmetrics;

import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import org.apache.commons.lang3.StringUtils;
import org.opensearch.dataprepper.model.types.ByteCount;
import org.opensearch.dataprepper.plugins.codec.CompressionOption;
Expand All @@ -27,11 +17,6 @@

import java.util.Set;


@Builder
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class OTelMetricsSourceConfig {
static final String REQUEST_TIMEOUT = "request_timeout";
static final String PORT = "port";
Expand Down Expand Up @@ -67,9 +52,6 @@ public class OTelMetricsSourceConfig {
static final String UNAUTHENTICATED_HEALTH_CHECK = "unauthenticated_health_check";
private static final String NAME_KEY = "name";
private static final String SERVICE_NAME_KEY = "service_name";
static final String HTTP_PATH = "http_path";
static final String AUTHENTICATION = "authentication";
static final String MAX_REQUEST_LENGTH = "max_request_length";

@JsonProperty(REQUEST_TIMEOUT)
private int requestTimeoutInMillis = DEFAULT_REQUEST_TIMEOUT_MS;
Expand Down Expand Up @@ -129,7 +111,7 @@ public class OTelMetricsSourceConfig {
@JsonProperty(MAX_CONNECTION_COUNT)
private int maxConnectionCount = DEFAULT_MAX_CONNECTION_COUNT;

@JsonProperty(AUTHENTICATION)
@JsonProperty("authentication")
private PluginModel authentication;

@JsonProperty(UNAUTHENTICATED_HEALTH_CHECK)
Expand All @@ -138,16 +120,12 @@ public class OTelMetricsSourceConfig {
@JsonProperty(COMPRESSION)
private CompressionOption compression = CompressionOption.NONE;

@JsonProperty(MAX_REQUEST_LENGTH)
@JsonProperty("max_request_length")
private ByteCount maxRequestLength;

@JsonProperty(RETRY_INFO)
private RetryInfoConfig retryInfo;

@JsonProperty(HTTP_PATH)
@Size(min = 1, message = "path length should be at least 1")
private String httpPath;

@AssertTrue(message = "buffer_partition_keys only supports 'name' and 'service_name'. 'name' is mandatory")
boolean isBufferKeysValid() {
if (bufferPartitionKeys == null) {
Expand Down Expand Up @@ -195,8 +173,106 @@ private boolean isSSLCertificateLocatedInS3() {
sslKeyFile.toLowerCase().startsWith(S3_PREFIX);
}

public int getRequestTimeoutInMillis() {
return requestTimeoutInMillis;
}

public int getPort() {
return port;
}

public String getPath() {
return path;
}

public boolean hasHealthCheck() {
return healthCheck;
}

public Set<String> getBufferPartitionKeys() {
return bufferPartitionKeys;
}

public boolean enableHttpHealthCheck() {
return isEnableUnframedRequests() && isHealthCheck();
return enableUnframedRequests() && hasHealthCheck();
}

public boolean hasProtoReflectionService() {
return protoReflectionService;
}

public boolean enableUnframedRequests() {
return enableUnframedRequests;
}

public boolean isSsl() {
return ssl;
}

public OTelOutputFormat getOutputFormat() {
return outputFormat;
}

public boolean useAcmCertForSSL() {
return useAcmCertForSSL;
}

public long getAcmCertIssueTimeOutMillis() {
return acmCertIssueTimeOutMillis;
}

public String getSslKeyCertChainFile() {
return sslKeyCertChainFile;
}

public String getSslKeyFile() {
return sslKeyFile;
}

public String getAcmCertificateArn() {
return acmCertificateArn;
}

public String getAcmPrivateKeyPassword() {
return acmPrivateKeyPassword;
}

public boolean isSslCertAndKeyFileInS3() {
return sslCertAndKeyFileInS3;
}

public String getAwsRegion() {
return awsRegion;
}

public int getThreadCount() {
return threadCount;
}

public int getMaxConnectionCount() {
return maxConnectionCount;
}

public PluginModel getAuthentication() { return authentication; }

public boolean isUnauthenticatedHealthCheck() {
return unauthenticatedHealthCheck;
}

public CompressionOption getCompression() {
return compression;
}

public ByteCount getMaxRequestLength() {
return maxRequestLength;
}

public RetryInfoConfig getRetryInfo() {
return retryInfo;
}

public void setRetryInfo(RetryInfoConfig retryInfo) {
this.retryInfo = retryInfo;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public CertificateProviderFactory(final OTelMetricsSourceConfig oTelMetricsSourc

public CertificateProvider getCertificateProvider() {
// ACM Cert for SSL takes preference
if (oTelMetricsSourceConfig.isUseAcmCertForSSL()) {
if (oTelMetricsSourceConfig.useAcmCertForSSL()) {
LOG.info("Using ACM certificate and private key for SSL/TLS.");
final AwsCredentialsProvider credentialsProvider = AwsCredentialsProviderChain.builder()
.addCredentialsProvider(DefaultCredentialsProvider.create()).build();
Expand Down

This file was deleted.

Loading
Loading