-
Notifications
You must be signed in to change notification settings - Fork 25
feat(opentelemetry): allow more customization for hive tracing setup #1611
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 originalOpentelemetrySetupOptions
to enable reuse across different setup functions - Refactored resource creation logic into a dedicated
createResource
helper function for better maintainability - Updated
hiveTracingSetup
to acceptBaseOptions
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.
export type HiveTracingSetupOptions = BaseOptions & HiveTracingOptions; | ||
|
||
export function hiveTracingSetup(config: HiveTracingSetupOptions) { |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
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, |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
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
.
[ATTR_SERVICE_VERSION]: userResource.serviceVersion, | |
...(userResource.serviceVersion !== undefined && { [ATTR_SERVICE_VERSION]: userResource.serviceVersion }), |
Copilot uses AI. Check for mistakes.
🚀 Snapshot Release (
|
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 ↗︎ |
🚀 Snapshot Release (Node Docker Image)The latest changes of this PR are available as image on GitHub Container Registry (based on the declared
|
🚀 Snapshot Release (Bun Docker Image)The latest changes of this PR are available as image on GitHub Container Registry (based on the declared
|
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 ownsamplingRate
to limit the Hive Console Tracing traffic.