← Back to Pull requests

Add grpc-swift-2 OTLP gRPC exporter behind the OTLPGRPCSwift2 trait #1306

Closed
unknown closed this pull request without merging on Dec 03, 2026 07:55 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 14:25 UTC
Author

Summary

Apps on grpc-swift-2 can't run the OTLP gRPC exporter next to their own gRPC code, and grpc-swift 1 is in maintenance mode. Add an exporter built on grpc-swift-2, as discussed in #729, on top of the traits from #1276, without breaking 3.0.0 users of the grpc-swift 1 exporter.

  • OTLPGRPCSwift2 enables the new OpenTelemetryProtocolExporterGrpcSwift2 product, built on grpc-swift-2. It needs iOS 18 / macOS 15.

  • init(client:) shares a GRPCClient the caller runs. init(transport:) creates, runs and stops its own client.

  • logger: is gone, and config.compression now applies.

  • OpenTelemetryProtocolExporter and OTLPGRPC stay on grpc-swift 1, as in 3.0.0. Its exporters are deprecated and point to the new product, so they can be removed in 4.0.

  • OtlpTraceJsonExporter builds without traits.

  • Examples/OTLP Exporter is unchanged. Examples/OTLP gRPC Swift 2 Exporter exports the same telemetry with grpc-swift-2, so you can compare the two.

  • The README has a section on migrating to grpc-swift-2.
  • Testing

    1. Run swift test --enable-all-traits --filter "OpenTelemetryProtocolExporterTests|OpenTelemetryProtocolExporterGrpcSwift2Tests". Assert that every test passes, including OtlpGrpcBlockingTests.
    2. In Examples/OTLP Exporter, run docker-compose up, then, from the repository root, swift run --traits OTLPGRPCSwift2 OTLPGRPCSwift2Exporter. Assert that the spans appear in Zipkin at <http://localhost:9411/zipkin/> and that the example exits cleanly.
    3. Run Scripts/check-trait-pruning.sh and Scripts/check-trait-diagnostics.sh. Assert that both pass, which means each gRPC stack resolves only with its trait.

    Limitations

  • Endpoint and TLS settings on OtlpConfiguration, and OTEL_EXPORTER_OTLP_ENDPOINT, are left for later. Callers build the transport.

  • There's no retry policy, as in the grpc-swift 1 exporter.

  • Sync export blocks its caller. It runs on a private serial executor, so it can't deadlock a saturated cooperative pool, but that relies on undocumented libdispatch behavior. With a client you run yourself, this is true only if its connections run off the pool.

  • grpc-swift stays pinned to 1.27.6.

  • Apps importing both exporter modules must qualify type names with the module.
  • Checklist

  • swift test --enable-all-traits passes locally, apart from five SDK and bridge tests that also fail on main locally and pass in CI

  • Unit tests added or updated for the change

  • Documentation updated (README, doc comments) where behavior changed
  • Diff: 318 lines (+238 / -80) across 3 files Reviewer: nachoBonafonte Review duration: 18330m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 318 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.345
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1306"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.0% · Safe to merge
    16.0%