Polish "Add service connection from Opentelemetry Collector for Logging"

See gh-41324
This commit is contained in:
Moritz Halbritter 2024-09-06 10:20:15 +02:00
parent 7adf843bfd
commit 8fc1bca56c
5 changed files with 5 additions and 5 deletions

View File

@ -35,7 +35,7 @@ public class OtlpLoggingProperties {
/** /**
* URL to the OTel collector's HTTP API. * URL to the OTel collector's HTTP API.
*/ */
private String endpoint = "http://localhost:4318/v1/logs"; private String endpoint;
/** /**
* Call timeout for the OTel Collector to process an exported batch of data. This * Call timeout for the OTel Collector to process an exported batch of data. This

View File

@ -32,7 +32,7 @@ class OpenTelemetryLoggingDockerComposeConnectionDetailsFactoryIntegrationTests
@DockerComposeTest(composeFile = "otlp-compose.yaml", image = TestImage.OPENTELEMETRY) @DockerComposeTest(composeFile = "otlp-compose.yaml", image = TestImage.OPENTELEMETRY)
void runCreatesConnectionDetails(OtlpLoggingConnectionDetails connectionDetails) { void runCreatesConnectionDetails(OtlpLoggingConnectionDetails connectionDetails) {
assertThat(connectionDetails.getEndpoint()).startsWith("http://").endsWith("/v1/logs"); assertThat(connectionDetails.getUrl()).startsWith("http://").endsWith("/v1/logs");
} }
} }

View File

@ -56,7 +56,7 @@ class OpenTelemetryLoggingDockerComposeConnectionDetailsFactory
} }
@Override @Override
public String getEndpoint() { public String getUrl() {
return "http://%s:%d/v1/logs".formatted(this.host, this.port); return "http://%s:%d/v1/logs".formatted(this.host, this.port);
} }

View File

@ -50,7 +50,7 @@ class OpenTelemetryLoggingContainerConnectionDetailsFactoryIntegrationTests {
@Test @Test
void connectionCanBeMadeToOpenTelemetryContainer() { void connectionCanBeMadeToOpenTelemetryContainer() {
assertThat(this.connectionDetails.getEndpoint()) assertThat(this.connectionDetails.getUrl())
.isEqualTo("http://" + container.getHost() + ":" + container.getMappedPort(4318) + "/v1/logs"); .isEqualTo("http://" + container.getHost() + ":" + container.getMappedPort(4318) + "/v1/logs");
} }

View File

@ -54,7 +54,7 @@ class OpenTelemetryLoggingContainerConnectionDetailsFactory
} }
@Override @Override
public String getEndpoint() { public String getUrl() {
return "http://%s:%d/v1/logs".formatted(getContainer().getHost(), getContainer().getMappedPort(4318)); return "http://%s:%d/v1/logs".formatted(getContainer().getHost(), getContainer().getMappedPort(4318));
} }