mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +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
|
@Override
|
||||||
public String getEndpoint() {
|
public String getUrl() {
|
||||||
return this.properties.getEndpoint();
|
return this.properties.getEndpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ final class OtlpTracingConfigurations {
|
|||||||
OtlpHttpSpanExporter otlpHttpSpanExporter(OtlpProperties properties,
|
OtlpHttpSpanExporter otlpHttpSpanExporter(OtlpProperties properties,
|
||||||
OtlpTracingConnectionDetails connectionDetails) {
|
OtlpTracingConnectionDetails connectionDetails) {
|
||||||
OtlpHttpSpanExporterBuilder builder = OtlpHttpSpanExporter.builder()
|
OtlpHttpSpanExporterBuilder builder = OtlpHttpSpanExporter.builder()
|
||||||
.setEndpoint(connectionDetails.getEndpoint())
|
.setEndpoint(connectionDetails.getUrl())
|
||||||
.setTimeout(properties.getTimeout())
|
.setTimeout(properties.getTimeout())
|
||||||
.setCompression(properties.getCompression().name().toLowerCase());
|
.setCompression(properties.getCompression().name().toLowerCase());
|
||||||
for (Entry<String, String> header : properties.getHeaders().entrySet()) {
|
for (Entry<String, String> header : properties.getHeaders().entrySet()) {
|
||||||
|
@ -30,6 +30,6 @@ public interface OtlpTracingConnectionDetails extends ConnectionDetails {
|
|||||||
* Address to where metrics will be published.
|
* Address to where metrics will be published.
|
||||||
* @return the 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
|
@Override
|
||||||
public String getEndpoint() {
|
public String getUrl() {
|
||||||
return "http://%s:%d/v1/traces".formatted(this.host, this.port);
|
return "http://%s:%d/v1/traces".formatted(this.host, this.port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class OpenTelemetryTracingDockerComposeConnectionDetailsFactoryIntegratio
|
|||||||
@Test
|
@Test
|
||||||
void runCreatesConnectionDetails() {
|
void runCreatesConnectionDetails() {
|
||||||
OtlpTracingConnectionDetails connectionDetails = run(OtlpTracingConnectionDetails.class);
|
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
|
@Override
|
||||||
public String getEndpoint() {
|
public String getUrl() {
|
||||||
return "http://%s:%d/v1/traces".formatted(getContainer().getHost(), getContainer().getMappedPort(4318));
|
return "http://%s:%d/v1/traces".formatted(getContainer().getHost(), getContainer().getMappedPort(4318));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class OpenTelemetryTracingConnectionDetailsFactoryIntegrationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void connectionCanBeMadeToOpenTelemetryContainer() {
|
void connectionCanBeMadeToOpenTelemetryContainer() {
|
||||||
assertThat(this.connectionDetails.getEndpoint())
|
assertThat(this.connectionDetails.getUrl())
|
||||||
.isEqualTo("http://" + container.getHost() + ":" + container.getMappedPort(4318) + "/v1/traces");
|
.isEqualTo("http://" + container.getHost() + ":" + container.getMappedPort(4318) + "/v1/traces");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user