Skip to content

feat(opentelemetry): circuit breaker in hive tracing#2007

Open
ardatan wants to merge 36 commits intomainfrom
circuit-breaker-otel
Open

feat(opentelemetry): circuit breaker in hive tracing#2007
ardatan wants to merge 36 commits intomainfrom
circuit-breaker-otel

Conversation

@ardatan
Copy link
Member

@ardatan ardatan commented Feb 24, 2026

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ardatan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the OpenTelemetry tracing capabilities within Hive by integrating a circuit breaker pattern into the span export mechanism. This change aims to improve the robustness and reliability of trace data submission, preventing cascading failures if the tracing backend becomes unavailable or slow, thereby ensuring the stability of the main application.

Highlights

  • Circuit Breaker Implementation: Introduced a new CircuitBreakerExporter to wrap existing OpenTelemetry span exporters, providing resilience against failing trace export destinations. This uses the opossum library to manage the circuit breaker logic.
  • Integration with Hive Tracing: The HiveTracingSpanProcessor has been updated to utilize the new CircuitBreakerExporter when an endpoint configuration is provided, allowing for configurable circuit breaker behavior for trace exports.
  • Dependency Updates: Added opossum as a production dependency and @types/opossum as a development dependency to support the circuit breaker functionality.
Changelog
  • .changeset/cyan-dolphins-add.md
    • Added a new changeset file documenting the circuit breaker feature for Hive Tracing.
  • packages/plugins/opentelemetry/package.json
    • Added opossum as a new dependency for circuit breaker functionality.
    • Added @types/opossum for TypeScript type definitions.
  • packages/plugins/opentelemetry/src/circuit-breaker-exporter.ts
    • Created a new CircuitBreakerExporter class that wraps a SpanExporter with circuit breaker logic.
  • packages/plugins/opentelemetry/src/hive-span-processor.ts
    • Imported CircuitBreakerConfiguration and CircuitBreakerExporter.
    • Updated HiveTracingSpanProcessorOptions to include circuitBreaker configuration.
    • Modified the HiveTracingSpanProcessor constructor to instantiate CircuitBreakerExporter around OTLPTraceExporter when an endpoint is configured.
  • yarn.lock
    • Updated the yarn.lock file to include the new opossum and @types/opossum dependencies.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ardatan ardatan force-pushed the circuit-breaker-otel branch from 2c93b6e to 7583843 Compare February 24, 2026 13:28
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a circuit breaker to the Hive tracing functionality using the opossum library. The changes include adding a new CircuitBreakerExporter that wraps the OTLP exporter and updating the HiveTracingSpanProcessor to use it.

My review identifies a few critical and high-severity issues in the new CircuitBreakerExporter implementation that could lead to incorrect behavior, such as ignoring user configuration and improper handling of an open circuit. I've also suggested making the circuit breaker feature optional to avoid a breaking change and improve flexibility. The provided code suggestions should help address these points.

@ardatan ardatan force-pushed the circuit-breaker-otel branch 3 times, most recently from d3cd53b to 7c501fa Compare February 24, 2026 13:32
@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 24, 2026

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-hive/gateway 2.5.1-alpha-003401fe140f7b52fa8028715dd09013a6e178bd npm ↗︎ unpkg ↗︎
@graphql-hive/nestjs 2.0.42-alpha-003401fe140f7b52fa8028715dd09013a6e178bd npm ↗︎ unpkg ↗︎
@graphql-hive/plugin-opentelemetry 1.4.0-alpha-003401fe140f7b52fa8028715dd09013a6e178bd npm ↗︎ unpkg ↗︎

@enisdenjo enisdenjo force-pushed the circuit-breaker-otel branch from 62bfe0a to c6c14b7 Compare February 25, 2026 17:06
@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 25, 2026

🚀 Snapshot Release (Binary for macOS-ARM64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 25, 2026

🚀 Snapshot Release (Binary for Linux-ARM64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 25, 2026

🚀 Snapshot Release (Binary for Linux-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 25, 2026

🚀 Snapshot Release (Binary for macOS-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 25, 2026

🚀 Snapshot Release (Bun Docker Image)

The latest changes of this PR are available as image on GitHub Container Registry (based on the declared changesets):

ghcr.io/graphql-hive/gateway:2.5.1-alpha-003401fe140f7b52fa8028715dd09013a6e178bd-bun

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 25, 2026

🚀 Snapshot Release (Binary for Windows-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 25, 2026

🚀 Snapshot Release (Node Docker Image)

The latest changes of this PR are available as image on GitHub Container Registry (based on the declared changesets):

ghcr.io/graphql-hive/gateway:2.5.1-alpha-003401fe140f7b52fa8028715dd09013a6e178bd

@enisdenjo enisdenjo marked this pull request as ready for review February 26, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants