Skip to content
Merged
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 @@ -9,8 +9,9 @@

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.logging.Logger;

class DockerHelper {
Expand All @@ -35,9 +36,8 @@ class DockerHelper {
*
* @return docker container ID. Empty string if it can`t be found.
*/
@SuppressWarnings("DefaultCharset")
public String getContainerId() {
try (BufferedReader br = new BufferedReader(new FileReader(cgroupPath))) {
try (BufferedReader br = Files.newBufferedReader(Paths.get(cgroupPath))) {
String line;
while ((line = br.readLine()) != null) {
if (line.length() > CONTAINER_ID_LENGTH) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.resources.ResourceBuilder;

public class AwsResourceDetector implements ComponentProvider<Resource> {
public class AwsResourceDetector implements ComponentProvider {

@Override
public Class<Resource> getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import io.opentelemetry.contrib.awsxray.propagator.AwsXrayPropagator;
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider;

public class AwsXrayComponentProvider implements ComponentProvider<TextMapPropagator> {
public class AwsXrayComponentProvider implements ComponentProvider {
@Override
public Class<TextMapPropagator> getType() {
return TextMapPropagator.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import io.opentelemetry.contrib.awsxray.propagator.AwsXrayLambdaPropagator;
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider;

public class AwsXrayLambdaComponentProvider implements ComponentProvider<TextMapPropagator> {
public class AwsXrayLambdaComponentProvider implements ComponentProvider {
@Override
public Class<TextMapPropagator> getType() {
return TextMapPropagator.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.resources.ResourceBuilder;

public final class AzureResourceDetector implements ComponentProvider<Resource> {
public final class AzureResourceDetector implements ComponentProvider {

@Override
public Class<Resource> getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
import io.opentelemetry.sdk.internal.IncludeExcludePredicate;
import io.opentelemetry.sdk.logs.LogRecordProcessor;

@SuppressWarnings("rawtypes")
@AutoService(ComponentProvider.class)
public class BaggageLogRecordComponentProvider implements ComponentProvider<LogRecordProcessor> {
public class BaggageLogRecordComponentProvider implements ComponentProvider {
@Override
public String getName() {
return "baggage";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
import io.opentelemetry.sdk.internal.IncludeExcludePredicate;
import io.opentelemetry.sdk.trace.SpanProcessor;

@SuppressWarnings("rawtypes")
@AutoService(ComponentProvider.class)
public class BaggageSpanComponentProvider implements ComponentProvider<SpanProcessor> {
public class BaggageSpanComponentProvider implements ComponentProvider {
@Override
public String getName() {
return "baggage";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ tasks {
if (name.contains("Jmh") || name.contains("Test")) {
// Allow underscore in test-type method names
disable("MemberName")
disable("SuppressWarningsWithoutExplanation")
}

option("NullAway:CustomContractAnnotations", "io.opentelemetry.api.internal.Contract")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public final class CelBasedSamplerComponentProvider implements ComponentProvider<Sampler> {
public final class CelBasedSamplerComponentProvider implements ComponentProvider {

private static final String ACTION_RECORD_AND_SAMPLE = "RECORD_AND_SAMPLE";
private static final String ACTION_DROP = "DROP";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider;
import io.opentelemetry.sdk.resources.Resource;

public final class CloudFoundryResourceDetector implements ComponentProvider<Resource> {
public final class CloudFoundryResourceDetector implements ComponentProvider {

@Override
public Class<Resource> getType() {
Expand Down
6 changes: 3 additions & 3 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
`java-platform`
}

val otelInstrumentationVersion = "2.21.0-alpha"
val otelInstrumentationVersion = "2.22.0-alpha-SNAPSHOT"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this PR blocked on the next instrumentation repo release?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, it can be merged we'll just update to release version once it is out. I chose to update to snapshot to get the latest otel sdk so I wouldn't need to add comments to the ComponentProvider usages.

val semconvVersion = "1.37.0"

javaPlatform {
Expand All @@ -27,8 +27,8 @@ dependencies {
api("com.google.auto.service:auto-service-annotations:1.1.1")
api("com.google.auto.value:auto-value:1.11.1")
api("com.google.auto.value:auto-value-annotations:1.11.1")
api("com.google.errorprone:error_prone_annotations:2.43.0")
api("com.google.errorprone:error_prone_core:2.43.0")
api("com.google.errorprone:error_prone_annotations:2.44.0")
api("com.google.errorprone:error_prone_core:2.44.0")
api("io.github.netmikey.logunit:logunit-jul:2.0.0")
api("io.opentelemetry.proto:opentelemetry-proto:1.8.0-alpha")
api("io.prometheus:simpleclient:0.16.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private static KeyValue attributeEntryToProto(AttributeKey<?> key, Object value)
return builder.build();
}

@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") // data type is checked before casting
private static AnyValue attributeValueToProto(AttributeType type, Object value) {
switch (type) {
case STRING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public Metric mapToProto(MetricData source) {
return metric.build();
}

@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") // data type is checked before casting
public MetricData mapToSdk(Metric source, Resource resource, InstrumentationScopeInfo scope) {
if (source.gauge != null) {
DataWithType gaugeDataWithType = mapGaugeToSdk(source.gauge);
Expand Down Expand Up @@ -153,7 +153,7 @@ public MetricData mapToSdk(Metric source, Resource resource, InstrumentationScop
}
}

@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") // data type is checked before casting
private static void addDataToProto(MetricData source, Metric.Builder target) {
switch (source.getType()) {
case LONG_GAUGE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.resources.ResourceBuilder;

public class GcpResourceDetector implements ComponentProvider<Resource> {
public class GcpResourceDetector implements ComponentProvider {

@Override
public Class<Resource> getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public WmqContext(QueueManager queueManager) {

/** Note: This Hashtable type is needed for IBM client classes. */
@SuppressWarnings("JdkObsolete")
public Hashtable<String, ?> getMqEnvironment() {
Hashtable<String, ?> env = new Hashtable<>();
public Hashtable<String, Object> getMqEnvironment() {
Hashtable<String, Object> env = new Hashtable<>();
addEnvProperty(env, CMQC.HOST_NAME_PROPERTY, queueManager.getHost());
addEnvProperty(env, CMQC.PORT_PROPERTY, queueManager.getPort());
addEnvProperty(env, CMQC.CHANNEL_PROPERTY, queueManager.getChannelName());
Expand All @@ -56,8 +56,8 @@ public WmqContext(QueueManager queueManager) {
return env;
}

@SuppressWarnings({"unused", "unchecked", "rawtypes"})
private static void addEnvProperty(Hashtable env, String propName, @Nullable Object propVal) {
private static void addEnvProperty(
Hashtable<String, Object> env, String propName, @Nullable Object propVal) {
if (null != propVal) {
if (propVal instanceof String) {
String propString = (String) propVal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,14 @@ int getTaskInitialDelaySeconds() {
}

@NotNull
@SuppressWarnings("unchecked")
List<String> getQueueManagerNames() {
return getQueueManagers().stream()
.map(o -> (Map<String, String>) o)
.map(x -> x.get("name"))
.map(x -> String.valueOf(x.get("name")))
.collect(Collectors.toList());
}

@NotNull
@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") // reading list from yaml
public List<Map<String, ?>> getQueueManagers() {
List<Map<String, ?>> result = (List<Map<String, ?>>) config.get("queueManagers");
if (result == null) {
Expand All @@ -87,7 +85,7 @@ List<String> getQueueManagerNames() {
}

@NotNull
@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") // reading map from yaml
public Map<String, String> getSslConnection() {
Map<String, String> result = (Map<String, String>) config.get("sslConnection");
if (result == null) {
Expand All @@ -105,7 +103,7 @@ public int getInt(String key, int defaultValue) {
}

@NotNull
@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") // reading map from yaml
public Map<String, ?> getMetrics() {
Object metrics = config.get("metrics");
if (!(metrics instanceof Map)) {
Expand All @@ -119,7 +117,7 @@ private static int defaultedInt(Map<String, ?> section, String key, int defaultV
return val instanceof Integer ? (Integer) val : defaultValue;
}

@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") // reading map from yaml
private Map<String, ?> getTaskSchedule() {
if (config.get("taskSchedule") instanceof Map) {
return (Map<String, ?>) config.get("taskSchedule");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ && isNotNullOrEmpty(queueManager.getReplyQueuePrefix())) {
}
}

@SuppressWarnings("rawtypes")
public static MQQueueManager connectToQueueManager(QueueManager queueManager) {
WmqContext auth = new WmqContext(queueManager);
Hashtable env = auth.getMqEnvironment();
Hashtable<String, ?> env = auth.getMqEnvironment();
try {
MQQueueManager ibmQueueManager = new MQQueueManager(queueManager.getName(), env);
logger.debug(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static SpanProcessor createSpanProcessor(ConfigProperties properties) {
return builder.build();
}

@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") // handler must implement BiConsumer<SpanBuilder, SpanContext>
private static BiConsumer<SpanBuilder, SpanContext> constructParentOverrideHandler(String name) {
try {
Class<?> clazz = Class.forName(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
import io.opentelemetry.sdk.trace.SpanProcessor;
import java.util.logging.Logger;

@SuppressWarnings("rawtypes")
@AutoService(ComponentProvider.class)
public class InferredSpansSpanProcessorProvider implements ComponentProvider<SpanProcessor> {
public class InferredSpansSpanProcessorProvider implements ComponentProvider {

private static final Logger log =
Logger.getLogger(InferredSpansSpanProcessorProvider.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider;
import io.opentelemetry.sdk.resources.Resource;

public class MavenResourceDetector implements ComponentProvider<Resource> {
public class MavenResourceDetector implements ComponentProvider {

@Override
public Class<Resource> getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public class EventToSpanEventBridgeComponentProvider
implements ComponentProvider<LogRecordProcessor> {
public class EventToSpanEventBridgeComponentProvider implements ComponentProvider {

@Override
public Class<LogRecordProcessor> getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider;
import io.opentelemetry.sdk.resources.Resource;

@SuppressWarnings("rawtypes")
@AutoService(ComponentProvider.class)
public final class AppServerResourceDetector implements ComponentProvider<Resource> {
public final class AppServerResourceDetector implements ComponentProvider {

@Override
public Class<Resource> getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public class RuleBasedRoutingSamplerComponentProvider implements ComponentProvider<Sampler> {
public class RuleBasedRoutingSamplerComponentProvider implements ComponentProvider {

private static final String ACTION_RECORD_AND_SAMPLE = "RECORD_AND_SAMPLE";
private static final String ACTION_DROP = "DROP";
Expand Down
6 changes: 6 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.gradle.kotlin.dsl.maven

pluginManagement {
plugins {
id("com.gradleup.shadow") version "9.2.2"
Expand All @@ -23,6 +25,10 @@ dependencyResolutionManagement {
includeGroupByRegex("""org\.terracotta.*""")
}
}
// for otel snapshots
maven {
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private static Class<?> getFilterType(String filterClass) {
}

@Nullable
@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") // filterType must implement Predicate<ReadableSpan>
private static Predicate<ReadableSpan> getFilterInstance(Class<?> filterType) {
try {
Constructor<?> constructor = filterType.getConstructor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider;
import io.opentelemetry.sdk.trace.SpanProcessor;

@SuppressWarnings("rawtypes")
@AutoService(ComponentProvider.class)
public class StackTraceComponentProvider implements ComponentProvider<SpanProcessor> {
public class StackTraceComponentProvider implements ComponentProvider {
@Override
public String getName() {
return "stacktrace/development";
Expand Down
Loading