Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update semconv to 1.21.0, PART 3 - SuppressWarnings #9373

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public static <REQUEST, RESPONSE> HttpClientAttributesExtractorBuilder<REQUEST,
}

@Override
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
super.onStart(attributes, parentContext, request);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ abstract class HttpCommonAttributesExtractor<
}

@Override
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
String method = getter.getHttpRequestMethod(request);
if (SemconvStability.emitStableHttpSemconv()) {
Expand All @@ -72,6 +73,7 @@ public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST
}

@Override
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void onEnd(
AttributesBuilder attributes,
Context context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

final class HttpMessageBodySizeUtil {

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
private static final AttributeKey<Long> HTTP_REQUEST_BODY_SIZE =
SemconvStability.emitOldHttpSemconv()
? SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH
: HttpAttributes.HTTP_REQUEST_BODY_SIZE;

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
private static final AttributeKey<Long> HTTP_RESPONSE_BODY_SIZE =
SemconvStability.emitOldHttpSemconv()
? SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public InternalClientAttributesExtractor(
this.emitOldHttpAttributes = emitOldHttpAttributes;
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void onStart(AttributesBuilder attributes, REQUEST request) {
AddressAndPort clientAddressAndPort = extractClientAddressAndPort(request);

Expand All @@ -48,6 +49,7 @@ public void onStart(AttributesBuilder attributes, REQUEST request) {
}
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void onEnd(AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) {
AddressAndPort clientAddressAndPort = extractClientAddressAndPort(request);
String clientSocketAddress = getter.getClientSocketAddress(request, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public InternalNetworkAttributesExtractor(
this.emitOldHttpAttributes = emitOldHttpAttributes;
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void onEnd(AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) {
String protocolName = lowercase(getter.getNetworkProtocolName(request, response));
String protocolVersion = lowercase(getter.getNetworkProtocolVersion(request, response));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private static Set<AttributeKey> buildAlwaysInclude() {
return view;
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
private static Set<AttributeKey> buildClientView() {
// the list of rpc client metrics attributes is from
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/rpc.md#attributes
Expand All @@ -52,6 +53,7 @@ private static Set<AttributeKey> buildClientView() {
return view;
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
private static Set<AttributeKey> buildServerView() {
// the list of rpc server metrics attributes is from
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/rpc.md#attributes
Expand All @@ -61,6 +63,7 @@ private static Set<AttributeKey> buildServerView() {
return view;
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
private static Set<AttributeKey> buildServerFallbackView() {
// the list of rpc server metrics attributes is from
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/rpc.md#attributes
Expand All @@ -79,6 +82,7 @@ static Attributes applyClientView(Attributes startAttributes, Attributes endAttr
return applyView(clientView, startAttributes, endAttributes);
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
static Attributes applyServerView(Attributes startAttributes, Attributes endAttributes) {
Set<AttributeKey> fullSet = serverView;
if (!containsAttribute(SemanticAttributes.NET_HOST_NAME, startAttributes, endAttributes)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public InternalUrlAttributesExtractor(
this.emitOldHttpAttributes = emitOldHttpAttributes;
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void onStart(AttributesBuilder attributes, REQUEST request) {
String urlScheme = getUrlScheme(request);
String urlPath = getter.getUrlPath(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.junit.jupiter.params.provider.ArgumentsProvider;
import org.junit.jupiter.params.provider.ArgumentsSource;

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
class HttpClientAttributesExtractorTest {

static class TestHttpClientAttributesGetter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
class HttpClientExperimentalMetricsTest {

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void collectsMetrics() {
InMemoryMetricReader metricReader = InMemoryMetricReader.create();
SdkMeterProvider meterProvider =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class HttpClientMetricsTest {
.toArray();

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void collectsMetrics() {
InMemoryMetricReader metricReader = InMemoryMetricReader.create();
SdkMeterProvider meterProvider =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.junit.jupiter.params.provider.ArgumentsProvider;
import org.junit.jupiter.params.provider.ArgumentsSource;

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
class HttpServerAttributesExtractorTest {

static class TestHttpServerAttributesGetter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
class HttpServerExperimentalMetricsTest {

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void collectsMetrics() {
InMemoryMetricReader metricReader = InMemoryMetricReader.create();
SdkMeterProvider meterProvider =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.Test;

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
class HttpServerMetricsTest {

static final double[] DEFAULT_BUCKETS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
class TemporaryMetricsViewTest {

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void shouldApplyClientDurationView() {
Attributes startAttributes =
Attributes.builder()
Expand Down Expand Up @@ -100,6 +101,7 @@ void shouldApplyClientDurationView_stableSemconv() {
}

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void shouldApplyServerDurationView() {
Attributes startAttributes =
Attributes.builder()
Expand Down Expand Up @@ -182,6 +184,7 @@ void shouldApplyServerDurationView_stableSemconv() {
}

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void shouldApplyClientSizeView() {
Attributes startAttributes =
Attributes.builder()
Expand Down Expand Up @@ -256,6 +259,7 @@ void shouldApplyClientSizeView_stableSemconv() {
}

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void shouldApplyServerSizeView() {
Attributes startAttributes =
Attributes.builder()
Expand Down Expand Up @@ -338,6 +342,7 @@ void shouldApplyServerSizeView_stableSemconv() {
}

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void shouldApplyActiveRequestsView() {
Attributes attributes =
Attributes.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import javax.annotation.Nullable;
import org.junit.jupiter.api.Test;

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
class ClientAttributesExtractorOldSemconvTest {

static class TestClientAttributesGetter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import javax.annotation.Nullable;
import org.junit.jupiter.api.Test;

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
class NetworkAttributesExtractorOldSemconvTest {

static class TestNetworkAttributesGetter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import javax.annotation.Nullable;
import org.junit.jupiter.api.Test;

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
class ServerAttributesExtractorOldSemconvTest {

static class TestServerAttributesGetter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
class MetricsViewTest {

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void shouldApplyClientView() {
Attributes startAttributes =
Attributes.builder()
Expand Down Expand Up @@ -81,6 +82,7 @@ void shouldApplyClientView_stableHttpSemconv() {
}

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void shouldApplyServerView() {
Attributes startAttributes =
Attributes.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
class RpcClientMetricsTest {

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void collectsMetrics() {
InMemoryMetricReader metricReader = InMemoryMetricReader.createDelta();
SdkMeterProvider meterProvider =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
class RpcServerMetricsTest {

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void collectsMetrics() {
InMemoryMetricReader metricReader = InMemoryMetricReader.createDelta();
SdkMeterProvider meterProvider =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public Integer getServerPort(Map<String, String> request) {
}

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void normal() {
Map<String, String> request = new HashMap<>();
request.put("method", "POST");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public Integer getServerPort(Map<String, Object> request) {
}

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void normal() {
Map<String, Object> request = new HashMap<>();
request.put("method", "POST");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ protected void configure(HttpClientTestOptions.Builder optionsBuilder) {
optionsBuilder.setHttpAttributes(this::getHttpAttributes);
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
protected Set<AttributeKey<?>> getHttpAttributes(URI uri) {
Set<AttributeKey<?>> attributes = new HashSet<>(HttpClientTestOptions.DEFAULT_HTTP_ATTRIBUTES);
// unopened port or non routable address; or timeout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void onThrowable(Throwable throwable) {
}

@Override
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
protected void configure(HttpClientTestOptions.Builder optionsBuilder) {
optionsBuilder.disableTestRedirects();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void onStart(
}
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void onRequest(AttributesBuilder attributes, APIGatewayProxyRequestEvent request) {
String method = request.getHttpMethod();
if (SemconvStability.emitStableHttpSemconv()) {
Expand Down Expand Up @@ -113,6 +114,7 @@ private static String getHttpUrl(
}

@Override
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void onEnd(
AttributesBuilder attributes,
Context context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public class AwsLambdaApiGatewayWrapperTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void setupEach() {
protected abstract InstrumentationExtension getTesting();

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void testClientWithQueryProtocolModel() {
server.enqueue(
HttpResponse.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public String getOperationName(
}

@Override
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void pre(
AttributesBuilder attributes,
Exchange exchange,
Expand Down Expand Up @@ -176,6 +177,7 @@ protected String getHttpUrl(Exchange exchange, Endpoint endpoint) {
}

@Override
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void post(AttributesBuilder attributes, Exchange exchange, Endpoint endpoint) {
super.post(attributes, exchange, endpoint);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ protected void cleanUp() {
}

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void restComponentServerAndClientCallWithJettyBackend() {
CamelContext camelContext = appContext.getBean(CamelContext.class);
ProducerTemplate template = camelContext.createProducerTemplate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ protected void cleanUp() {
}

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public void singleCamelServiceSpan() {
URI requestUrl = address.resolve("/camelService");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void configure() {
}

@Test
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void twoCamelServiceSpans() throws Exception {
createAndStartClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static SpanDataAssert sqs(
return sqs(span, spanName, queueUrl, queueName, CLIENT);
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
static SpanDataAssert sqs(
SpanDataAssert span, String spanName, String queueUrl, String queueName, SpanKind spanKind) {

Expand Down Expand Up @@ -88,6 +89,7 @@ static SpanDataAssert sqs(
equalTo(stringKey("rpc.service"), "AmazonSQS"));
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
static SpanDataAssert s3(SpanDataAssert span, String spanName, String bucketName, String method) {
return span.hasName(spanName)
.hasAttributesSatisfyingExactly(
Expand Down Expand Up @@ -115,6 +117,7 @@ static SpanDataAssert s3(SpanDataAssert span, String spanName, String bucketName
v -> val.isInstanceOf(Number.class), v -> assertThat(v).isNull())));
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
static SpanDataAssert sns(SpanDataAssert span, String spanName) {
return span.hasName(spanName)
.hasKind(CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public class CassandraClientTest {

private static final Logger logger = LoggerFactory.getLogger(CassandraClientTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
public abstract class AbstractCassandraTest {

private static final Logger logger = LoggerFactory.getLogger(AbstractCassandraTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public abstract class AbstractCassandra44Test extends AbstractCassandraTest {

@ParameterizedTest(name = "{index}: {0}")
@MethodSource("provideReactiveParameters")
@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
void reactiveTest(Parameter parameter) {
CqlSession session = getSession(parameter.keyspace);

Expand Down
Loading
Loading