Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(redis): sentinel support #8260

Merged
merged 4 commits into from
Feb 11, 2025
Merged

feat(redis): sentinel support #8260

merged 4 commits into from
Feb 11, 2025

Conversation

ardatan
Copy link
Owner

@ardatan ardatan commented Jan 13, 2025

Support Redis Sentinels - See more

Summary by CodeRabbit

  • New Features

    • Introduced enhanced Redis caching capabilities with integrated Sentinel support for improved failover and connection management.
    • Enabled flexible configuration options allowing users to choose between Sentinel and standard Redis setups.
    • Added support for specifying the IP address family in Redis configurations.
  • Documentation

    • Updated the user guides to provide clear instructions on configuring and utilizing the new Redis Sentinel options for optimal performance and security.
    • Added detailed documentation for new Redis configuration parameters, including sentinelPassword, sentinels, and REDIS_FAMILY.

Copy link
Contributor

github-actions bot commented Jan 13, 2025

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

Copy link
Contributor

github-actions bot commented Jan 13, 2025

🚀 Snapshot Release (alpha)

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

Package Version Info
@graphql-mesh/cache-cfw-kv 0.104.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-file 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-inmemory-lru 0.0.10-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-localforage 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-redis 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/compose-cli 1.3.8-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/fusion-composition 0.7.20-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/include 0.2.13-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/apollo-link 0.105.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/cli 0.98.20-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/config 0.106.20-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/graphql 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/grpc 0.107.5-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/json-schema 0.108.17-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/mongoose 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/mysql 0.104.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/neo4j 0.105.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/odata 0.105.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/openapi 0.108.18-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/postgraphile 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/raml 0.108.16-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/soap 0.105.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/supergraph 0.9.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/thrift 0.105.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/tuql 0.104.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/http 0.105.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-bare 0.104.17-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-stitching 0.104.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/migrate-config-cli 1.4.12-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/runtime 0.105.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/store 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-cache 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-encapsulate 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-extend 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-federation 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-filter-schema 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-hive 0.103.17-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-hoist-field 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-naming-convention 0.103.16-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-prefix 0.103.16-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-prune 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-rate-limit 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-rename 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-replace-field 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-resolvers-composition 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-transfer-schema 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-type-merging 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/types 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/urql-exchange 0.105.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/utils 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@omnigraph/json-schema 0.108.16-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@omnigraph/mysql 0.8.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@omnigraph/neo4j 0.9.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@omnigraph/odata 0.1.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@omnigraph/openapi 0.108.18-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@omnigraph/raml 0.108.16-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@omnigraph/soap 0.105.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@omnigraph/sqlite 0.7.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@omnigraph/thrift 0.8.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-deduplicate-request 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-hive 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http-cache 0.104.2-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http-details-extensions 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-jit 0.1.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-jwt-auth 1.4.4-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-live-query 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-mock 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-newrelic 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-operation-field-permissions 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-operation-headers 1.3.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-rate-limit 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-response-cache 0.103.15-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-snapshot 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-statsd 0.103.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-grpc 0.2.4-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-mysql 0.8.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-neo4j 0.8.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-odata 0.1.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-rest 0.8.16-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-soap 0.8.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-sqlite 0.8.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-thrift 0.8.14-alpha-20250211122553-3fb64ebde7eaf7cfa395a075898678d4518d149c npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Jan 13, 2025

💻 Website Preview

The latest changes are available as preview in: https://994fb9cd.graphql-mesh.pages.dev

@ardatan ardatan marked this pull request as draft January 14, 2025 14:20
@ardatan ardatan marked this pull request as ready for review February 11, 2025 11:49
Copy link
Contributor

coderabbitai bot commented Feb 11, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This pull request introduces support for Redis Sentinel configurations within the GraphQL Mesh framework. The changes modify the RedisCache constructor to prioritize sentinel options over legacy URL or individual connection parameters. Additionally, Redis configuration types have been updated across GraphQL schemas and legacy type definitions to include a union of Sentinel and single-instance setups, along with new enums and interfaces. Documentation files have also been updated to reflect these new properties and configuration options, including the addition of the REDIS_FAMILY configuration for specifying IP address family.

Changes

Files Change Summary
.changeset/ten-houses-unite.md
website/src/generated-markdown/RedisConfig*.generated.md
website/src/generated-markdown/RedisSentinelConfig.generated.md
Updated documentation to detail Redis Sentinel support, outlining new properties (name, sentinelPassword, sentinels, role, preferredSlave, enableTLSForSentinelMode, etc.) and revised configuration descriptions.
packages/cache/redis/src/index.ts Modified the RedisCache constructor to prioritize sentinel configuration when available, incorporating options like name, sentinelPassword, and a list of sentinels, and added logic to determine the IPv6 family using a new parsedFamily variable.
packages/cache/redis/yaml-config.graphql
packages/legacy/types/src/config-schema.json
packages/legacy/types/src/config.ts
Updated Redis configuration schema and type definitions to support a union type (`RedisConfigSentinel
packages/legacy/types/src/config.ts Added new interfaces for Redis configurations, including RedisConfigSentinel and RedisSentinelConfig, and updated the Cache interface to accept these new types.
packages/legacy/types/src/config-schema.json Revised the redis property to accept configurations for both RedisConfigSentinel and RedisConfigSingle, enhancing flexibility in Redis setups.
packages/legacy/types/src/config.ts Introduced the REDIS_FAMILY configuration option to specify the IP address family.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant RedisCache
    participant RedisClient

    Client->>RedisCache: Instantiate with options
    RedisCache->>RedisCache: Check for "sentinels" option
    alt Sentinel configuration provided
        RedisCache->>RedisClient: Create client using sentinel options (name, sentinelPassword, sentinels, etc.)
    else URL provided
        RedisCache->>RedisClient: Validate URL and create client with URL settings
    else
        RedisCache->>RedisClient: Create client using individual connection parameters
    end
Loading

Poem

Hoppity-hop in the code I weave,
Redis sentinels now stand and achieve.
With sentinels guarding like stars so bright,
My cache leaps lively into the night.
A bunny’s grin as new paths unfurl—
A joyful dance in a Redis whirl! 🐰✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/cache/redis/yaml-config.graphql

Oops! Something went wrong! :(

ESLint: 9.20.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71413ea and 3fb64eb.

📒 Files selected for processing (2)
  • .changeset/eleven-carpets-nail.md (1 hunks)
  • packages/cache/redis/yaml-config.graphql (1 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (11)
.changeset/@graphql-mesh_grpc-8260-dependencies.md (1)

4-5: LGTM with a minor formatting note.

The patch version bump looks good. Note: The list indentation can be adjusted to align with markdown standards, but this is a minor formatting issue.

-  - Updated dependency [`@omnigraph/grpc@^0.2.1` ↗︎](https://www.npmjs.com/package/@omnigraph/grpc/v/0.2.1) (from `^0.2.0`, in `dependencies`)
+- Updated dependency [`@omnigraph/grpc@^0.2.1` ↗︎](https://www.npmjs.com/package/@omnigraph/grpc/v/0.2.1) (from `^0.2.0`, in `dependencies`)
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

5-5: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

packages/cache/redis/src/index.ts (2)

24-39: Consider adding fallback/error handling for partial sentinel configuration.

It might be beneficial to ensure that each sentinel config in options.sentinels has valid host and port, and to handle any missing or malformed entries. This helps avoid runtime exceptions if only some fields are provided.


81-81: Confirm IPv6 assignment logic.

Setting family to 6 if parsedFamily === '6' is straightforward, but consider logging a warning or error if parsedFamily is invalid, to facilitate troubleshooting potential misconfigurations.

packages/legacy/types/src/config.ts (2)

1836-1862: Clarify sentinel role and environment usage.

For RedisConfigSentinel, consider clarifying in commentary how each parameter (e.g., sentinelPassword, role) interacts with environment variables or defaults. This helps users avoid misconfiguration when switching from local to production.


1875-1876: Align family property usage between single and sentinel.

For RedisConfigSingle, the optional family property complements the same field in RedisSentinelConfig. Consider documenting that both accept '4' or '6', and confirm consistent interpretation in the code.

website/src/generated-markdown/RedisSentinelConfig.generated.md (1)

2-4: Include example usage for new properties in docs.

To help users configure Redis Sentinel more confidently, supplement this list with usage examples for host, port, and family (e.g., specifying numeric strings for IPv4 vs. IPv6).

website/src/generated-markdown/RedisConfigSingle.generated.md (1)

3-3: Consider using Int type for port.

The port parameter is defined as a String, but it should be an Int since ports are numeric values. This would provide better type safety and validation.

website/src/generated-markdown/RedisConfigSentinel.generated.md (1)

6-6: Consider using Int type for sentinel port.

The port parameter in sentinel configuration is defined as a String, but it should be an Int for better type safety and validation.

website/src/generated-markdown/RedisConfig.generated.md (1)

13-13: Add missing comma for better readability.

Add a comma after "instances" in the sentence: "A list of sentinels to connect to. The list does not need to enumerate all your sentinel instances, but a few so that if one is down the client will try the next one."

🧰 Tools
🪛 LanguageTool

[uncategorized] ~13-~13: Possible missing comma found.
Context: ... instances, but a few so that if one is down the client will try the next one.: *...

(AI_HYDRA_LEO_MISSING_COMMA)

packages/cache/redis/yaml-config.graphql (1)

43-43: Consider using Int type for ports.

The port fields in both RedisSentinelConfig and RedisConfigSingle are defined as String, but they should be Int for better type safety and validation.

Apply this diff:

type RedisSentinelConfig @md {
  host: String
-  port: String
+  port: Int
  family: String
}

type RedisConfigSingle @md {
  host: String
-  port: String
+  port: Int
  username: String
  password: String
  db: Int
  url: String
  family: String
  """

Also applies to: 49-49

.changeset/@omnigraph_raml-8260-dependencies.md (1)

7-7: Remove unnecessary dependency entry.

The to-json-schema dependency entry shows no version change (0.2.5 → 0.2.5) and can be safely removed from the changeset.

-  - Updated dependency [`to-json-schema@^0.2.5` ↗︎](https://www.npmjs.com/package/to-json-schema/v/0.2.5) (from `0.2.5`, in `dependencies`)
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

7-7: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa5cbcb and 803e352.

📒 Files selected for processing (21)
  • .changeset/@graphql-mesh_grpc-8260-dependencies.md (1 hunks)
  • .changeset/@graphql-mesh_json-schema-8260-dependencies.md (1 hunks)
  • .changeset/@graphql-mesh_mongoose-8260-dependencies.md (1 hunks)
  • .changeset/@graphql-mesh_openapi-8260-dependencies.md (1 hunks)
  • .changeset/@graphql-mesh_plugin-http-details-extensions-8260-dependencies.md (1 hunks)
  • .changeset/@graphql-mesh_raml-8260-dependencies.md (1 hunks)
  • .changeset/@graphql-mesh_transport-rest-8260-dependencies.md (1 hunks)
  • .changeset/@omnigraph_grpc-8260-dependencies.md (1 hunks)
  • .changeset/@omnigraph_json-schema-8260-dependencies.md (1 hunks)
  • .changeset/@omnigraph_openapi-8260-dependencies.md (1 hunks)
  • .changeset/@omnigraph_raml-8260-dependencies.md (1 hunks)
  • .changeset/json-machete-8260-dependencies.md (1 hunks)
  • .changeset/ten-houses-unite.md (1 hunks)
  • packages/cache/redis/src/index.ts (3 hunks)
  • packages/cache/redis/yaml-config.graphql (1 hunks)
  • packages/legacy/types/src/config-schema.json (3 hunks)
  • packages/legacy/types/src/config.ts (2 hunks)
  • website/src/generated-markdown/RedisConfig.generated.md (1 hunks)
  • website/src/generated-markdown/RedisConfigSentinel.generated.md (1 hunks)
  • website/src/generated-markdown/RedisConfigSingle.generated.md (1 hunks)
  • website/src/generated-markdown/RedisSentinelConfig.generated.md (1 hunks)
✅ Files skipped from review due to trivial changes (9)
  • .changeset/@omnigraph_grpc-8260-dependencies.md
  • .changeset/@graphql-mesh_transport-rest-8260-dependencies.md
  • .changeset/@graphql-mesh_raml-8260-dependencies.md
  • .changeset/@graphql-mesh_mongoose-8260-dependencies.md
  • .changeset/@graphql-mesh_plugin-http-details-extensions-8260-dependencies.md
  • .changeset/json-machete-8260-dependencies.md
  • .changeset/@graphql-mesh_json-schema-8260-dependencies.md
  • .changeset/@omnigraph_json-schema-8260-dependencies.md
  • .changeset/@omnigraph_openapi-8260-dependencies.md
🧰 Additional context used
🪛 LanguageTool
website/src/generated-markdown/RedisConfig.generated.md

[uncategorized] ~13-~13: Possible missing comma found.
Context: ... instances, but a few so that if one is down the client will try the next one.: *...

(AI_HYDRA_LEO_MISSING_COMMA)

🪛 markdownlint-cli2 (0.17.2)
.changeset/@graphql-mesh_grpc-8260-dependencies.md

5-5: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

.changeset/@graphql-mesh_openapi-8260-dependencies.md

5-5: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

.changeset/@omnigraph_raml-8260-dependencies.md

5-5: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)


6-6: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)


7-7: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: e2e / node v18
🔇 Additional comments (9)
.changeset/@graphql-mesh_grpc-8260-dependencies.md (1)

1-6: Verify the relationship with Redis Sentinel feature.

This changeset updates @omnigraph/grpc from ^0.2.0 to ^0.2.1, but it's not immediately clear how this relates to the Redis Sentinel support feature described in the PR objectives.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check if the version bump contains Redis-related changes

# Get the changelog or release notes for @omnigraph/[email protected]
curl -s https://registry.npmjs.org/@omnigraph/grpc | jq -r '."dist-tags", .versions["0.2.1"].description, .versions["0.2.1"].changelog'

# Search for any Redis-related changes in the codebase that might depend on this version
rg -i "redis.*@omnigraph/grpc" 

Length of output: 286


Dependency update and formatting note verified.

  • The executed script shows no evidence linking the @omnigraph/grpc patch update to Redis Sentinel support.
  • The registry output for version 0.2.1 lacks changelog details, and the search for Redis-related mentions returned no results.
  • Aside from a minor markdown list indentation issue, the dependency bump is a routine patch update.
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

5-5: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

packages/cache/redis/src/index.ts (1)

69-70: Validate or sanitize the parsed family value.

Currently, the code interpolates options.family or REDIS_FAMILY but does not handle invalid or empty values. Consider adding a check to make sure the final parsedFamily remains a valid numeric string.

packages/legacy/types/src/config.ts (1)

1808-1810: Ensure consumers are aware of the new Redis config union.

The updated property redis?: RedisConfigSentinel | RedisConfigSingle; introduces two distinct ways to configure Redis. Update documentation or examples to clarify how to select between sentinel and single-instance setups.

.changeset/ten-houses-unite.md (1)

1-7: LGTM!

The version bump and documentation link are appropriate for the Redis Sentinel feature addition.

packages/cache/redis/yaml-config.graphql (1)

5-5: LGTM!

The union type design provides good flexibility for supporting both single and sentinel Redis configurations.

packages/legacy/types/src/config-schema.json (2)

17-27: Well-structured Redis configuration schema!

The Redis configuration schema elegantly supports both Sentinel and Single instance configurations using anyOf. The description clearly indicates the available options.


84-120: Comprehensive Redis Sentinel configuration type!

The RedisConfigSentinel type provides excellent coverage of Sentinel features:

  • Required group name and sentinel list
  • Optional authentication and TLS support
  • Role selection for master/slave routing
  • Clear descriptions for all properties
.changeset/@graphql-mesh_openapi-8260-dependencies.md (1)

1-5: LGTM! Dependency update looks good.

The patch update for @graphql-mesh/openapi and its dependency on @omnigraph/openapi follows semantic versioning practices.

Let's verify that the new version of @omnigraph/openapi is compatible with Redis Sentinel support:

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Description: Check the changelog or release notes of @omnigraph/openapi for Redis Sentinel related changes

# Check the package.json and changelog
gh api repos/ardatan/graphql-mesh/contents/packages/openapi/omnigraph-openapi/CHANGELOG.md --ref $(git rev-parse HEAD) | jq -r '.content' | base64 -d | grep -A 5 "0.108.14"

Length of output: 1672


Let's try a revised script that directly reads the local changelog file for the omnigraph-openapi package and looks for both the version update and any mention of "Redis Sentinel" support. This should help us determine if the new version is compatible. Please run the following shell script:


🏁 Script executed:

#!/bin/bash
FILE="packages/openapi/omnigraph-openapi/CHANGELOG.md"
if [ -f "$FILE" ]; then
  echo "Context around version 0.108.14:"
  grep -A 5 "0.108.14" "$FILE"
  echo ""
  echo "Checking for Redis Sentinel support mentions:"
  grep -R "Redis Sentinel" "$FILE"
else
  echo "Changelog file not found at $FILE"
fi

Length of output: 276


Dependency Update Approved – Manual Verification Needed for Redis Sentinel Support

  • The changeset file correctly updates @omnigraph/openapi from version 0.108.13 to 0.108.14 per semantic versioning practices.
  • Our automated search did not locate a changelog or any notes (e.g., "Redis Sentinel") in the omnigraph-openapi package, so we couldn’t automatically confirm Redis Sentinel compatibility.
  • Please manually verify that the changes in version 0.108.14 support Redis Sentinel as expected (e.g., by checking the upstream repository’s release notes or documentation).
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

5-5: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

.changeset/@omnigraph_raml-8260-dependencies.md (1)

5-6: Verify dependency updates support Redis Sentinel feature.

Since this PR introduces Redis Sentinel support, let's verify that these dependency updates contain the necessary changes.

✅ Verification successful

🌐 Web query:

What changes were introduced in @omnigraph/json-schema v0.108.12 and json-machete v0.97.6?

💡 Result:

The latest versions of @omnigraph/json-schema (v0.108.12) and json-machete (v0.97.6) include several updates focused on dependency management and compatibility:

@omnigraph/json-schema v0.108.12

  • Dependency Update: Upgraded graphql-compose from v9.0.11 to v9.1.0 (January 12, 2025) [5].
    This ensures compatibility with newer features or fixes in the graphql-compose library.

json-machete v0.97.6

  • Maintenance Release: Published on January 15, 2025 ([2][4]).
    No specific functional changes are detailed in the provided sources, but it likely includes minor optimizations or dependency updates to align with ecosystem tools like GraphQL Mesh.

Key Context

  • Both packages are part of the GraphQL Mesh ecosystem, which automates schema generation from JSON Schema/APIs.
  • @omnigraph/json-schema focuses on converting JSON Schemas into GraphQL types ([3]).
  • json-machete aids in processing JSON Schemas (e.g., dereferencing) during schema generation workflows ([2][4]).

No breaking changes or major feature additions are explicitly noted for these versions in the provided sources[1][2][3][4][5].

Citations:


Dependency Versions and Redis Sentinel Support Verification

Based on the release notes for the updated packages:

  • @omnigraph/json-schema v0.108.12
    • The update primarily upgrades the internal dependency (graphql-compose from v9.0.11 to v9.1.0) to ensure compatibility with the latest features and fixes, with no mention of Redis Sentinel.

  • json-machete v0.97.6
    • This is noted as a maintenance release with minor optimizations and dependency adjustments, again with no explicit changes related to Redis Sentinel.

There’s no evidence from these notes that the dependency updates include new or modified behavior directly targeting Redis Sentinel support. If Redis Sentinel support is required by the new feature in this PR, its implementation is likely provided elsewhere rather than through modifications in these dependency packages.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

5-5: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)


6-6: Unordered list indentation
Expected: 0; Actual: 2

(MD007, ul-indent)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/legacy/types/src/config.ts (1)

1860-1864: ⚠️ Potential issue

Make host and port required in RedisSentinelConfig.

The host and port properties in RedisSentinelConfig should be required as they are essential for connecting to sentinel instances.

Apply this diff to fix the issue:

-  host?: string;
-  port?: string;
+  host: string;
+  port: string;
🧹 Nitpick comments (1)
packages/legacy/types/src/config-schema.json (1)

84-120: Consider adding default value for role field.

The RedisConfigSentinel type is well-defined with clear descriptions and required fields. Consider enhancing the role field description to specify the default value (typically "master").

        "role": {
          "type": "string",
          "enum": ["master", "slave"],
-         "description": "(optional) with a value of slave will return a random slave from the Sentinel group. (Allowed values: master, slave)"
+         "description": "(optional) with a value of slave will return a random slave from the Sentinel group. Default: master (Allowed values: master, slave)"
        },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 803e352 and ad0272f.

📒 Files selected for processing (5)
  • .changeset/ten-houses-unite.md (1 hunks)
  • packages/cache/redis/src/index.ts (3 hunks)
  • packages/cache/redis/yaml-config.graphql (1 hunks)
  • packages/legacy/types/src/config-schema.json (3 hunks)
  • packages/legacy/types/src/config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .changeset/ten-houses-unite.md
  • packages/cache/redis/yaml-config.graphql
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: unit / node 22
  • GitHub Check: unit / node 20
  • GitHub Check: e2e / node v22
  • GitHub Check: integration / node 22
  • GitHub Check: unit / node 18
  • GitHub Check: e2e / node v20
  • GitHub Check: integration / node 20
  • GitHub Check: e2e / node v18
  • GitHub Check: integration / node 18
  • GitHub Check: apollo-federation-compatibility
  • GitHub Check: check
  • GitHub Check: release / snapshot
  • GitHub Check: deployment
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (8)
packages/cache/redis/src/index.ts (2)

24-39: LGTM! Redis Sentinel support implementation looks good.

The implementation correctly:

  • Checks for sentinel configuration using 'sentinels' in options
  • Handles sentinel password with environment variable interpolation
  • Maps sentinel configurations with proper type conversions
  • Sets required Redis client options

69-70: Verify IPv6 support across Redis configurations.

The IPv6 family support has been added consistently across both single instance and sentinel configurations. However, let's verify that the Redis client properly handles IPv6 addresses in both modes.

Run the following script to check IPv6 support in the Redis client:

Also applies to: 81-81

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Description: Check if Redis client properly handles IPv6 addresses.

# Test: Search for IPv6 address handling in Redis client.
rg -A 5 'family.*6' node_modules/ioredis/lib/

Length of output: 113


IPv6 Redis Client Handling: Manual Verification Required

The initial script did not produce output since the expected directory (node_modules/ioredis/lib/) wasn't found. This makes the automatic check inconclusive. Please manually verify that the Redis client—in both single instance and sentinel configurations—is correctly handling IPv6 addresses (i.e., that the family option is being passed and respected by the client).

  • Confirm that the family option (derived from options.family?.toString() or process.env.REDIS_FAMILY) is correctly relayed to the ioredis client initialization.
  • Verify in your testing environment (or via localized logs) that when an IPv6 address is provided, the connection is established as expected.
packages/legacy/types/src/config.ts (3)

1804-1807: LGTM! Redis configuration type union is well-defined.

The union type correctly allows either sentinel or single instance configuration.


1832-1859: LGTM! RedisConfigSentinel interface is comprehensive.

The interface includes all necessary properties for Redis Sentinel configuration with clear documentation.


1872-1872: LGTM! Family property added to RedisConfigSingle.

The family property has been consistently added to support IPv6 in single instance mode.

packages/legacy/types/src/config-schema.json (3)

17-27: LGTM! Well-structured Redis configuration union type.

The redis property is now properly defined to support both Sentinel and Single instance configurations using anyOf, with clear documentation.


121-136: Add required fields for Sentinel configuration.

The RedisSentinelConfig type should specify required fields for host and port as they are essential for connecting to Sentinel instances.

{
  "additionalProperties": false,
  "type": "object",
  "title": "RedisSentinelConfig",
  "properties": {
    "host": {
      "type": "string"
    },
    "port": {
      "type": "string"
    },
    "family": {
      "type": "string"
    }
  },
+ "required": ["host", "port"]
}

137-168: LGTM! Well-structured single instance configuration.

The RedisConfigSingle type maintains backward compatibility while adding the family field for consistency with sentinel configuration.

Copy link
Collaborator

@dotansimha dotansimha left a comment

Choose a reason for hiding this comment

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

just one comment :) thanks!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.changeset/eleven-carpets-nail.md (1)

1-6: Enhance the changeset description with more details.

While the changeset correctly uses a patch version for this backward-compatible feature, the description could be more informative for users and maintainers.

Consider expanding the description with:

 ---
 '@graphql-mesh/cache-redis': patch
 ---
 
-Support REDIS_FAMILY to set family of the IP address
+Support REDIS_FAMILY to set family of the IP address (IPv4 or IPv6).
+
+This enhancement allows you to explicitly specify the IP address family when connecting to Redis instances:
+- 4: Force IPv4
+- 6: Force IPv6
+- 0: Automatic (default)
+
+This is particularly useful in network environments where specific IP protocols are required or when troubleshooting connection issues.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad0272f and 71413ea.

📒 Files selected for processing (1)
  • .changeset/eleven-carpets-nail.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: apollo-federation-compatibility
  • GitHub Check: unit / node 22
  • GitHub Check: e2e / node v22
  • GitHub Check: integration / node 22
  • GitHub Check: unit / node 20
  • GitHub Check: integration / node 20
  • GitHub Check: unit / node 18
  • GitHub Check: e2e / node v20
  • GitHub Check: integration / node 18
  • GitHub Check: release / snapshot
  • GitHub Check: e2e / node v18
  • GitHub Check: check
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: deployment

@ardatan ardatan merged commit fc44a1e into master Feb 11, 2025
16 of 18 checks passed
@ardatan ardatan deleted the redis-sentinel branch February 11, 2025 12:24
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.

2 participants