mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Polish "Add service connection from OpenTelemetry Collector"
See gh-35082
This commit is contained in:
parent
23cf20e368
commit
3dd6372602
@ -60,7 +60,7 @@ final class OtlpTracingConfigurations {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEndpoint() {
|
||||
public String getUrl() {
|
||||
return this.properties.getEndpoint();
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ final class OtlpTracingConfigurations {
|
||||
OtlpHttpSpanExporter otlpHttpSpanExporter(OtlpProperties properties,
|
||||
OtlpTracingConnectionDetails connectionDetails) {
|
||||
OtlpHttpSpanExporterBuilder builder = OtlpHttpSpanExporter.builder()
|
||||
.setEndpoint(connectionDetails.getEndpoint())
|
||||
.setEndpoint(connectionDetails.getUrl())
|
||||
.setTimeout(properties.getTimeout())
|
||||
.setCompression(properties.getCompression().name().toLowerCase());
|
||||
for (Entry<String, String> header : properties.getHeaders().entrySet()) {
|
||||
|
@ -30,6 +30,6 @@ public interface OtlpTracingConnectionDetails extends ConnectionDetails {
|
||||
* Address to where metrics will be published.
|
||||
* @return the address to where metrics will be published
|
||||
*/
|
||||
String getEndpoint();
|
||||
String getUrl();
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class OpenTelemetryTracingDockerComposeConnectionDetailsFactory
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEndpoint() {
|
||||
public String getUrl() {
|
||||
return "http://%s:%d/v1/traces".formatted(this.host, this.port);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class OpenTelemetryTracingDockerComposeConnectionDetailsFactoryIntegratio
|
||||
@Test
|
||||
void runCreatesConnectionDetails() {
|
||||
OtlpTracingConnectionDetails connectionDetails = run(OtlpTracingConnectionDetails.class);
|
||||
assertThat(connectionDetails.getEndpoint()).startsWith("http://").endsWith("/v1/traces");
|
||||
assertThat(connectionDetails.getUrl()).startsWith("http://").endsWith("/v1/traces");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class OpenTelemetryTracingConnectionDetailsFactory
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEndpoint() {
|
||||
public String getUrl() {
|
||||
return "http://%s:%d/v1/traces".formatted(getContainer().getHost(), getContainer().getMappedPort(4318));
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class OpenTelemetryTracingConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
@Test
|
||||
void connectionCanBeMadeToOpenTelemetryContainer() {
|
||||
assertThat(this.connectionDetails.getEndpoint())
|
||||
assertThat(this.connectionDetails.getUrl())
|
||||
.isEqualTo("http://" + container.getHost() + ":" + container.getMappedPort(4318) + "/v1/traces");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user