Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -19,8 +19,9 @@ nullaway {
tasks {
withType<JavaCompile>().configureEach {
if (name.contains("test", ignoreCase = true)) {
options.errorprone.nullaway {
enabled = false
// For test compilation tasks, disable errorprone entirely to avoid nullaway issues
options.errorprone {
isEnabled.set(false)
Copy link
Member

Choose a reason for hiding this comment

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

we'd only disable errorprone for test source if nullaway is enabled for the module?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, we are only disabling error prone for test sources if the module has the plugin installed viaid("otel.nullaway-conventions")

Copy link
Member

Choose a reason for hiding this comment

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

oh, so errorprone will still run on those test source, just via a different mechanism?

Copy link
Member Author

Choose a reason for hiding this comment

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

no, this will turn error prone off entirely for those particular test sources. I assumed it would be ok to not run it on test code, but maybe that was an incorrect assumption on my part. I couldn't figure out a way to just disable nullaway without disabling errorprone entirely, but I can keep digging

Copy link
Member

@zeitlinger zeitlinger Sep 26, 2025

Choose a reason for hiding this comment

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

does this work

tasks {
  withType<JavaCompile>().configureEach {
    options.errorprone.nullaway {
      if (name.contains("test", ignoreCase = true)) {
        disable()
      } else {
        error()
      }
      customInitializerAnnotations.add("org.openjdk.jmh.annotations.Setup")
      excludedFieldAnnotations.add("org.mockito.Mock")
      excludedFieldAnnotations.add("org.mockito.InjectMocks")
    }
  }
}

}
} else {
options.errorprone.nullaway {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.instrumentation.docs;

import static java.util.Collections.emptyList;
import static org.assertj.core.api.Assertions.assertThat;

import com.fasterxml.jackson.core.JsonProcessingException;
Expand Down Expand Up @@ -142,40 +143,11 @@ void testEmptyAdditionalTelemetry() throws JsonProcessingException {

InstrumentationMetadata actualMetadata = YamlHelper.metaDataParser(yamlContent);

ManualTelemetryEntry defaultEntry =
new ManualTelemetryEntry(
"default",
List.of(
new ManualTelemetryEntry.ManualMetric(
"system.disk.io",
"System disk IO",
"LONG_SUM",
"By",
List.of(
new TelemetryAttribute("device", "STRING"),
new TelemetryAttribute("direction", "STRING")))),
List.of(
new ManualTelemetryEntry.ManualSpan(
"CLIENT", List.of(new TelemetryAttribute("custom.operation", "STRING")))));

ManualTelemetryEntry experimentalEntry =
new ManualTelemetryEntry(
"experimental",
List.of(
new ManualTelemetryEntry.ManualMetric(
"experimental.feature.usage",
"Usage of experimental features",
"HISTOGRAM",
"s",
List.of(new TelemetryAttribute("feature.name", "STRING")))),
List.of());

InstrumentationMetadata expectedMetadata =
new InstrumentationMetadata.Builder()
.description("Example instrumentation with manual telemetry documentation")
.libraryLink("https://example.com/library")
.description("Example without manual telemetry")
.semanticConventions(List.of(SemanticConvention.HTTP_CLIENT_SPANS))
.additionalTelemetry(List.of(defaultEntry, experimentalEntry))
.additionalTelemetry(emptyList())
.overrideTelemetry(false)
.build();

Expand Down
Loading