Skip to content

Commit

Permalink
Polish "Add service connection from Opentelemetry Collector for Logging"
Browse files Browse the repository at this point in the history
  • Loading branch information
mhalbritter committed Sep 6, 2024
1 parent 7adf843 commit 8fc1bca
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class OtlpLoggingProperties {
/**
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class OpenTelemetryLoggingDockerComposeConnectionDetailsFactoryIntegrationTests

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private OpenTelemetryLoggingDockerComposeConnectionDetails(RunningService source
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class OpenTelemetryLoggingContainerConnectionDetailsFactoryIntegrationTests {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private OpenTelemetryLoggingContainerConnectionDetails(ContainerConnectionSource
}

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

Expand Down

0 comments on commit 8fc1bca

Please sign in to comment.