|
| 1 | +/* |
| 2 | + * Copyright The OpenTelemetry Authors |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
| 6 | +package io.opentelemetry.instrumentation.armeria.v1_3; |
| 7 | + |
| 8 | +import com.linecorp.armeria.client.WebClientBuilder; |
| 9 | +import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; |
| 10 | +import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpClientTest; |
| 11 | +import io.opentelemetry.instrumentation.testing.junit.http.HttpClientInstrumentationExtension; |
| 12 | +import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions; |
| 13 | +import java.util.Collections; |
| 14 | +import org.junit.jupiter.api.extension.RegisterExtension; |
| 15 | + |
| 16 | +@SuppressWarnings("deprecation") |
| 17 | +class ArmeriaHttpClientOldTest extends AbstractArmeriaHttpClientTest { |
| 18 | + |
| 19 | + @RegisterExtension |
| 20 | + static final InstrumentationExtension testing = HttpClientInstrumentationExtension.forLibrary(); |
| 21 | + |
| 22 | + @Override |
| 23 | + protected WebClientBuilder configureClient(WebClientBuilder clientBuilder) { |
| 24 | + return clientBuilder.decorator( |
| 25 | + ArmeriaTelemetry.builder(testing.getOpenTelemetry()) |
| 26 | + .setCapturedClientRequestHeaders( |
| 27 | + Collections.singletonList(AbstractHttpClientTest.TEST_REQUEST_HEADER)) |
| 28 | + .setCapturedClientResponseHeaders( |
| 29 | + Collections.singletonList(AbstractHttpClientTest.TEST_RESPONSE_HEADER)) |
| 30 | + .build() |
| 31 | + .newClientDecorator()); |
| 32 | + } |
| 33 | + |
| 34 | + @Override |
| 35 | + protected void configure(HttpClientTestOptions.Builder optionsBuilder) { |
| 36 | + super.configure(optionsBuilder); |
| 37 | + |
| 38 | + // library instrumentation doesn't have a good way of suppressing nested CLIENT spans yet |
| 39 | + optionsBuilder.disableTestWithClientParent(); |
| 40 | + |
| 41 | + // Agent users have automatic propagation through executor instrumentation, but library users |
| 42 | + // should do manually using Armeria patterns. |
| 43 | + optionsBuilder.disableTestCallbackWithParent(); |
| 44 | + optionsBuilder.disableTestErrorWithCallback(); |
| 45 | + } |
| 46 | +} |
0 commit comments