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

Conditionally escape yoga http duration histogram #3443

Open
klippx opened this issue Oct 10, 2024 · 0 comments · May be fixed by #3444
Open

Conditionally escape yoga http duration histogram #3443

klippx opened this issue Oct 10, 2024 · 0 comments · May be fixed by #3444

Comments

@klippx
Copy link
Contributor

klippx commented Oct 10, 2024

Is your feature request related to a problem? Please describe.

We are using hive-gateway and the prometheus plugin. We want to conditionally use graphql_yoga_http_duration for certain operations only, but it can only always be used or never be used.

Describe the solution you'd like

    metrics: {
      graphql_yoga_http_duration: createHistogram({
        registry,
        histogram: {
          name: 'graphql_yoga_http_duration',
          help: 'Time spent on HTTP connection',
          labelNames: ['operation_name'],
          buckets: HISTOGRAM_BUCKET_DIMENSIONS,
        },
        fillLabelsFn: ({ operationName }, _rawContext) => ({
          operation_name: operationName,
        }),
        // A hook to decide when recording should be made
        shouldRecordFn: ({ operationName }, _rawContext) =>
          TRACKED_OPERATIONS.includes(operationName),
      }),
    },

Describe alternatives you've considered

Build our own middleware stack mostly duplicating everything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant