Skip to content

Conversation

EmrysMyrddin
Copy link
Collaborator

@EmrysMyrddin EmrysMyrddin commented Oct 14, 2025

This PR allows to pass the same configuration options that can be passed to the classic openTelemetrySetup.

The main interest is to allow user to define its own resource (with service name and version) and it's own samplingRate to limit the Hive Console Tracing traffic.

@Copilot Copilot AI review requested due to automatic review settings October 14, 2025 14:47
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the OpenTelemetry tracing setup to allow more customization for Hive tracing configuration. It extracts common options into a reusable BaseOptions type and simplifies resource creation logic.

  • Extracted BaseOptions type from the original OpentelemetrySetupOptions to enable reuse across different setup functions
  • Refactored resource creation logic into a dedicated createResource helper function for better maintainability
  • Updated hiveTracingSetup to accept BaseOptions and provide default service name/version attributes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +298 to +300
export type HiveTracingSetupOptions = BaseOptions & HiveTracingOptions;

export function hiveTracingSetup(config: HiveTracingSetupOptions) {
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The hiveTracingSetup function signature change removes the contextManager and log parameters that were previously required. This is a breaking change - existing callers that pass these parameters separately will fail. Consider maintaining backward compatibility or documenting this as a breaking change.

Copilot uses AI. Check for mistakes.

return baseResource.merge(
resourceFromAttributes({
[ATTR_SERVICE_NAME]: userResource.serviceName,
[ATTR_SERVICE_VERSION]: userResource.serviceVersion,
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

Potential undefined access: userResource.serviceVersion is accessed without checking if it exists. If userResource has serviceName but not serviceVersion, this will set the service version to undefined.

Suggested change
[ATTR_SERVICE_VERSION]: userResource.serviceVersion,
...(userResource.serviceVersion !== undefined && { [ATTR_SERVICE_VERSION]: userResource.serviceVersion }),

Copilot uses AI. Check for mistakes.

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 14, 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-hive/gateway 2.1.11-alpha-761f53f2ad68893f5e00259cc765a22fc8fe90aa npm ↗︎ unpkg ↗︎
@graphql-hive/nestjs 2.0.16-alpha-761f53f2ad68893f5e00259cc765a22fc8fe90aa npm ↗︎ unpkg ↗︎
@graphql-hive/plugin-aws-sigv4 2.0.11-alpha-761f53f2ad68893f5e00259cc765a22fc8fe90aa npm ↗︎ unpkg ↗︎
@graphql-hive/plugin-opentelemetry 1.1.0-alpha-761f53f2ad68893f5e00259cc765a22fc8fe90aa npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-prometheus 2.0.14-alpha-761f53f2ad68893f5e00259cc765a22fc8fe90aa npm ↗︎ unpkg ↗︎
@graphql-hive/gateway-runtime 2.1.10-alpha-761f53f2ad68893f5e00259cc765a22fc8fe90aa npm ↗︎ unpkg ↗︎

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 14, 2025

🚀 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 Oct 14, 2025

🚀 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 Oct 14, 2025

🚀 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 Oct 14, 2025

🚀 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 Oct 14, 2025

🚀 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 Oct 14, 2025

🚀 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.1.11-alpha-761f53f2ad68893f5e00259cc765a22fc8fe90aa

@theguild-bot
Copy link
Collaborator

theguild-bot commented Oct 14, 2025

🚀 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.1.11-alpha-761f53f2ad68893f5e00259cc765a22fc8fe90aa-bun

@n1ru4l n1ru4l self-requested a review October 14, 2025 18:26
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