@graphql-hive/plugin-opentelemetry 1.4.27 → 1.4.28-alpha-03f5ea48d335f095ec840268e8aba52ad6bd3be9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @graphql-hive/plugin-opentelemetry
2
2
 
3
+ ## 1.4.28-alpha-03f5ea48d335f095ec840268e8aba52ad6bd3be9
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#2389](https://github.com/graphql-hive/gateway/pull/2389) [`03f5ea4`](https://github.com/graphql-hive/gateway/commit/03f5ea48d335f095ec840268e8aba52ad6bd3be9) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Attach `hive.request.id` to the root HTTP span at all times
9
+
3
10
  ## 1.4.27
4
11
  ### Patch Changes
5
12
 
@@ -863,20 +863,20 @@ function useOpenTelemetry(options) {
863
863
  );
864
864
  },
865
865
  onRequest({ state, serverContext }) {
866
- if (traces && !useContextManager) {
867
- const requestId = (
868
- // TODO: serverContext.log will not be available in Yoga, this will be fixed when Hive Logger is integrated into Yoga
869
- serverContext.log?.attrs?.[
870
- // @ts-expect-error even if the attrs is an array this will work
871
- "requestId"
872
- ]
873
- );
874
- if (typeof requestId === "string") {
875
- const httpCtx = state.forRequest.otel?.root;
876
- const httpSpan = httpCtx && trace.getSpan(httpCtx);
877
- httpSpan?.setAttribute(SEMATTRS_HIVE_REQUEST_ID, requestId);
878
- otelCtxForRequestId.set(requestId, getContext(state));
879
- }
866
+ const requestId = (
867
+ // TODO: serverContext.log will not be available in Yoga, this will be fixed when Hive Logger is integrated into Yoga
868
+ serverContext.log?.attrs?.[
869
+ // @ts-expect-error even if the attrs is an array this will work
870
+ "requestId"
871
+ ]
872
+ );
873
+ if (typeof requestId === "string") {
874
+ const httpCtx = state.forRequest.otel?.root;
875
+ const httpSpan = httpCtx && trace.getSpan(httpCtx);
876
+ httpSpan?.setAttribute(SEMATTRS_HIVE_REQUEST_ID, requestId);
877
+ }
878
+ if (traces && !useContextManager && typeof requestId === "string") {
879
+ otelCtxForRequestId.set(requestId, getContext(state));
880
880
  }
881
881
  },
882
882
  onEnveloped({ state, extendContext }) {
@@ -865,20 +865,20 @@ function useOpenTelemetry(options) {
865
865
  );
866
866
  },
867
867
  onRequest({ state, serverContext }) {
868
- if (traces && !useContextManager) {
869
- const requestId = (
870
- // TODO: serverContext.log will not be available in Yoga, this will be fixed when Hive Logger is integrated into Yoga
871
- serverContext.log?.attrs?.[
872
- // @ts-expect-error even if the attrs is an array this will work
873
- "requestId"
874
- ]
875
- );
876
- if (typeof requestId === "string") {
877
- const httpCtx = state.forRequest.otel?.root;
878
- const httpSpan = httpCtx && api.trace.getSpan(httpCtx);
879
- httpSpan?.setAttribute(attributes.SEMATTRS_HIVE_REQUEST_ID, requestId);
880
- otelCtxForRequestId.set(requestId, getContext(state));
881
- }
868
+ const requestId = (
869
+ // TODO: serverContext.log will not be available in Yoga, this will be fixed when Hive Logger is integrated into Yoga
870
+ serverContext.log?.attrs?.[
871
+ // @ts-expect-error even if the attrs is an array this will work
872
+ "requestId"
873
+ ]
874
+ );
875
+ if (typeof requestId === "string") {
876
+ const httpCtx = state.forRequest.otel?.root;
877
+ const httpSpan = httpCtx && api.trace.getSpan(httpCtx);
878
+ httpSpan?.setAttribute(attributes.SEMATTRS_HIVE_REQUEST_ID, requestId);
879
+ }
880
+ if (traces && !useContextManager && typeof requestId === "string") {
881
+ otelCtxForRequestId.set(requestId, getContext(state));
882
882
  }
883
883
  },
884
884
  onEnveloped({ state, extendContext }) {
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var circuitBreakerExporter = require('./circuit-breaker-exporter-Dlje4qsx.cjs');
3
+ var circuitBreakerExporter = require('./circuit-breaker-exporter-I2fKMbqg.cjs');
4
4
  var api = require('@opentelemetry/api');
5
5
  var attributes = require('./attributes.cjs');
6
6
  var semanticConventions = require('@opentelemetry/semantic-conventions');
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CircuitBreakerExporter, u as useOpenTelemetry } from './circuit-breaker-exporter-BVLeHUg6.js';
1
+ export { C as CircuitBreakerExporter, u as useOpenTelemetry } from './circuit-breaker-exporter-CYpCu8Yi.js';
2
2
  export { DiagLogLevel as OpenTelemetryDiagLogLevel } from '@opentelemetry/api';
3
3
  export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH, SEMATTRS_HIVE_REQUEST_ID, SEMATTRS_IS_HIVE_GRAPHQL_OPERATION, SEMATTRS_IS_HIVE_REQUEST, SEMATTRS_IS_HIVE_SUBGRAPH_EXECUTION } from './attributes.js';
4
4
  export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
package/dist/setup.cjs CHANGED
@@ -6,7 +6,7 @@ var core = require('@opentelemetry/core');
6
6
  var resources = require('@opentelemetry/resources');
7
7
  var sdkTraceBase = require('@opentelemetry/sdk-trace-base');
8
8
  var semanticConventions = require('@opentelemetry/semantic-conventions');
9
- var circuitBreakerExporter = require('./circuit-breaker-exporter-Dlje4qsx.cjs');
9
+ var circuitBreakerExporter = require('./circuit-breaker-exporter-I2fKMbqg.cjs');
10
10
  var exporterTraceOtlpHttp = require('@opentelemetry/exporter-trace-otlp-http');
11
11
  var attributes = require('./attributes.cjs');
12
12
  var apiLogs = require('@opentelemetry/api-logs');
@@ -224,7 +224,7 @@ function getContextForRequest(attributes) {
224
224
  return circuitBreakerExporter.otelCtxForRequestId.get(attributes.requestId) ?? api.ROOT_CONTEXT;
225
225
  }
226
226
 
227
- globalThis.__OTEL_PLUGIN_VERSION__ = '1.4.27';
227
+ globalThis.__OTEL_PLUGIN_VERSION__ = '1.4.28-alpha-03f5ea48d335f095ec840268e8aba52ad6bd3be9';
228
228
  let initialized = false;
229
229
  function openTelemetrySetup(options) {
230
230
  const log = (options.log || new logger.Logger()).child("[OpenTelemetry] ");
package/dist/setup.js CHANGED
@@ -5,7 +5,7 @@ import { resourceFromAttributes } from '@opentelemetry/resources';
5
5
  import { BatchSpanProcessor, SimpleSpanProcessor, ConsoleSpanExporter, BasicTracerProvider, ParentBasedSampler, AlwaysOnSampler, TraceIdRatioBasedSampler } from '@opentelemetry/sdk-trace-base';
6
6
  import { ATTR_SERVICE_VERSION, ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
7
7
  export { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMATTRS_HTTP_CLIENT_IP, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_SERVER_NAME, SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_USER_AGENT, SEMATTRS_NET_HOST_NAME } from '@opentelemetry/semantic-conventions';
8
- import { C as CircuitBreakerExporter, o as otelCtxForRequestId, g as getEnvStr, a as getEnvBool, d as diagLogLevelFromEnv } from './circuit-breaker-exporter-BVLeHUg6.js';
8
+ import { C as CircuitBreakerExporter, o as otelCtxForRequestId, g as getEnvStr, a as getEnvBool, d as diagLogLevelFromEnv } from './circuit-breaker-exporter-CYpCu8Yi.js';
9
9
  import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
10
10
  import { SEMATTRS_IS_HIVE_SUBGRAPH_EXECUTION, SEMATTRS_HIVE_GRAPHQL_ERROR_CODES, SEMATTRS_HIVE_GRAPHQL_ERROR_COUNT, SEMATTRS_HIVE_GATEWAY_OPERATION_SUBGRAPH_NAMES, SEMATTRS_IS_HIVE_REQUEST, SEMATTRS_IS_HIVE_GRAPHQL_OPERATION } from './attributes.js';
11
11
  export { SEMATTRS_GRAPHQL_DOCUMENT, SEMATTRS_GRAPHQL_OPERATION_NAME, SEMATTRS_GRAPHQL_OPERATION_TYPE, SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME, SEMATTRS_HIVE_GRAPHQL_OPERATION_HASH, SEMATTRS_HIVE_REQUEST_ID } from './attributes.js';
@@ -224,7 +224,7 @@ function getContextForRequest(attributes) {
224
224
  return otelCtxForRequestId.get(attributes.requestId) ?? ROOT_CONTEXT;
225
225
  }
226
226
 
227
- globalThis.__OTEL_PLUGIN_VERSION__ = '1.4.27';
227
+ globalThis.__OTEL_PLUGIN_VERSION__ = '1.4.28-alpha-03f5ea48d335f095ec840268e8aba52ad6bd3be9';
228
228
  let initialized = false;
229
229
  function openTelemetrySetup(options) {
230
230
  const log = (options.log || new Logger()).child("[OpenTelemetry] ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-hive/plugin-opentelemetry",
3
- "version": "1.4.27",
3
+ "version": "1.4.28-alpha-03f5ea48d335f095ec840268e8aba52ad6bd3be9",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",