diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4445fd3..e752c8b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -124,7 +124,7 @@ jobs: - name: Setup Spin uses: fermyon/actions/spin/setup@v1 with: - version: "v3.6.1" + version: "v4.0.0" - name: Run Tests run: just test diff --git a/Justfile b/Justfile index da0c76a..a0f2c3a 100644 --- a/Justfile +++ b/Justfile @@ -57,5 +57,4 @@ test: @cd go && go test ./... # Test: Integration tests - # TODO: Until this issue is taken care of, these will continue to fail: https://github.com/bytecodealliance/opentelemetry-wasi/issues/45 - # @cargo test --manifest-path integration_tests/Cargo.toml + @cargo test --manifest-path integration_tests/Cargo.toml diff --git a/go/examples/spin-basic/spin.toml b/go/examples/spin-basic/spin.toml index 4172f6f..5aef343 100644 --- a/go/examples/spin-basic/spin.toml +++ b/go/examples/spin-basic/spin.toml @@ -16,5 +16,5 @@ component = "go-spin-basic" source = "main.wasm" key_value_stores = ["default"] [component.go-spin-basic.build] -command = "go tool componentize-go build" +command = "go mod tidy && go tool componentize-go build" watch = ["**/*.go", "go.mod"] diff --git a/integration_tests/src/lib.rs b/integration_tests/src/lib.rs index c56f98c..cd4fc3b 100644 --- a/integration_tests/src/lib.rs +++ b/integration_tests/src/lib.rs @@ -290,6 +290,8 @@ mod tests { let child = Command::new("spin") .env("OTEL_EXPORTER_OTLP_ENDPOINT", self.collector_endpoint) .env("OTEL_EXPORTER_OTLP_PROTOCOL", "grpc") + // Reduce BatchSpanProcessor export interval to 100ms + .env("OTEL_BSP_SCHEDULE_DELAY", "100") .args(["up", "--experimental-wasi-otel", "-f", self.path]) .spawn()?; @@ -340,9 +342,16 @@ mod tests { /// Recursively parse the children of an `ExportedSpan` into a `SpanTree`. fn build_node(parent: &'a ExportedSpan, all_spans: &'a [ExportedSpan]) -> Self { - let children: Vec> = all_spans + let mut child_spans: Vec<&'a ExportedSpan> = all_spans .iter() .filter(|e| e.parent_span_id == parent.span_id) + .collect(); + + // If the spans aren't sorted, the `span_paternity_test` might return a false negative + child_spans.sort_by_key(|s| s.start_time_unix_nano); + + let children: Vec> = child_spans + .into_iter() .map(|child| Self::build_node(child, all_spans)) .collect(); diff --git a/integration_tests/src/snapshots/integration_tests__tests__go_spin_basic_logs.snap b/integration_tests/src/snapshots/integration_tests__tests__go_spin_basic_logs.snap index c339c85..0ae71da 100644 --- a/integration_tests/src/snapshots/integration_tests__tests__go_spin_basic_logs.snap +++ b/integration_tests/src/snapshots/integration_tests__tests__go_spin_basic_logs.snap @@ -10,4 +10,4 @@ expression: log_data body: "AnyValue { value: Some(StringValue(\"Hello from Go!\")) }" attributes: {} dropped_attributes_count: 0 - flags: 0 + flags: 1 diff --git a/integration_tests/src/snapshots/integration_tests__tests__typescript_spin_basic_logs.snap b/integration_tests/src/snapshots/integration_tests__tests__typescript_spin_basic_logs.snap index 31947ac..82a1202 100644 --- a/integration_tests/src/snapshots/integration_tests__tests__typescript_spin_basic_logs.snap +++ b/integration_tests/src/snapshots/integration_tests__tests__typescript_spin_basic_logs.snap @@ -2,12 +2,12 @@ source: src/lib.rs expression: log_data --- -- trace_id: "[trace_id:len(0)]" - span_id: "[span_id:len(0)]" +- trace_id: "[trace_id:len(32)]" + span_id: "[span_id:len(16)]" observed_time_unix_nano: "[timestamp]" severity_number: 9 severity_text: INFO body: "AnyValue { value: Some(StringValue(\"Hello from TypeScript!\")) }" attributes: {} dropped_attributes_count: 0 - flags: 0 + flags: 1