@envelop/prometheus 6.0.2-alpha-304a55e.0 → 6.1.1-alpha-e859732.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -8,4 +8,4 @@ declare type PluginInternalContext = {
8
8
  [promPluginContext]: FillLabelsFnParams;
9
9
  [promPluginExecutionStartTimeSymbol]: number;
10
10
  };
11
- export declare const usePrometheus: (config?: PrometheusTracingPluginConfig) => Plugin<PluginInternalContext>;
11
+ export declare const usePrometheus: (config?: PrometheusTracingPluginConfig) => Plugin<{}, PluginInternalContext>;
package/index.js CHANGED
@@ -261,7 +261,9 @@ const usePrometheus = (config = {}) => {
261
261
  const startTime = Date.now();
262
262
  return () => {
263
263
  const totalTime = (Date.now() - startTime) / 1000;
264
- contextBuildingHistogram.histogram.observe(contextBuildingHistogram.fillLabelsFn(context[promPluginContext], context), totalTime);
264
+ if (context[promPluginContext]) {
265
+ contextBuildingHistogram.histogram.observe(contextBuildingHistogram.fillLabelsFn(context[promPluginContext], context), totalTime);
266
+ }
265
267
  };
266
268
  }
267
269
  : undefined;
package/index.mjs CHANGED
@@ -257,7 +257,9 @@ const usePrometheus = (config = {}) => {
257
257
  const startTime = Date.now();
258
258
  return () => {
259
259
  const totalTime = (Date.now() - startTime) / 1000;
260
- contextBuildingHistogram.histogram.observe(contextBuildingHistogram.fillLabelsFn(context[promPluginContext], context), totalTime);
260
+ if (context[promPluginContext]) {
261
+ contextBuildingHistogram.histogram.observe(contextBuildingHistogram.fillLabelsFn(context[promPluginContext], context), totalTime);
262
+ }
261
263
  };
262
264
  }
263
265
  : undefined;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/prometheus",
3
- "version": "6.0.2-alpha-304a55e.0",
3
+ "version": "6.1.1-alpha-e859732.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "2.0.1-alpha-304a55e.0",
6
+ "@envelop/core": "2.1.1-alpha-e859732.0",
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0",
8
8
  "prom-client": "^13 || ^14.0.0"
9
9
  },
package/utils.d.ts CHANGED
@@ -16,7 +16,7 @@ export declare type FillLabelsFnParams = {
16
16
  deprecationInfo?: DeprecatedFieldInfo;
17
17
  };
18
18
  export declare function shouldTraceFieldResolver(info: GraphQLResolveInfo, whitelist: string[] | undefined): boolean;
19
- export declare function createInternalContext(parseResult: AfterParseEventPayload<any>['result']): FillLabelsFnParams | null;
19
+ export declare function createInternalContext(parseResult: AfterParseEventPayload<any, any>['result']): FillLabelsFnParams | null;
20
20
  export declare type FillLabelsFn<LabelNames extends string> = (params: FillLabelsFnParams, rawContext: any) => Record<LabelNames, string>;
21
21
  export declare function createHistogram<LabelNames extends string>(options: {
22
22
  histogram: Histogram<LabelNames>;