@opentelemetry/instrumentation-graphql
Advanced tools
Comparing version 0.26.0 to 0.26.1
@@ -235,5 +235,3 @@ "use strict"; | ||
if (processedArgs.variableValues && config.allowValues) { | ||
Object.entries(processedArgs.variableValues).forEach(([key, value]) => { | ||
span.setAttribute(`${AttributeNames_1.AttributeNames.VARIABLES}${String(key)}`, value); | ||
}); | ||
utils_1.addInputVariableAttributes(span, processedArgs.variableValues); | ||
} | ||
@@ -240,0 +238,0 @@ return span; |
@@ -5,2 +5,5 @@ import type * as graphqlTypes from 'graphql'; | ||
import { GraphQLInstrumentationConfig, GraphQLInstrumentationParsedConfig, OtelPatched, Maybe } from './types'; | ||
export declare function addInputVariableAttributes(span: api.Span, variableValues: { | ||
[key: string]: any; | ||
}): void; | ||
export declare function addSpanSource(span: api.Span, loc?: graphqlTypes.Location, allowValues?: boolean, start?: number, end?: number): void; | ||
@@ -7,0 +10,0 @@ export declare function endSpan(span: api.Span, error?: Error): void; |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.wrapFieldResolver = exports.wrapFields = exports.getSourceFromLocation = exports.getOperation = exports.endSpan = exports.addSpanSource = void 0; | ||
exports.wrapFieldResolver = exports.wrapFields = exports.getSourceFromLocation = exports.getOperation = exports.endSpan = exports.addSpanSource = exports.addInputVariableAttributes = void 0; | ||
const api = require("@opentelemetry/api"); | ||
@@ -25,2 +25,25 @@ const enum_1 = require("./enum"); | ||
const OPERATION_VALUES = Object.values(enum_1.AllowedOperationTypes); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function addInputVariableAttribute(span, key, variable) { | ||
if (Array.isArray(variable)) { | ||
variable.forEach((value, idx) => { | ||
addInputVariableAttribute(span, `${key}.${idx}`, value); | ||
}); | ||
} | ||
else if (variable instanceof Object) { | ||
Object.entries(variable).forEach(([nestedKey, value]) => { | ||
addInputVariableAttribute(span, `${key}.${nestedKey}`, value); | ||
}); | ||
} | ||
else { | ||
span.setAttribute(`${AttributeNames_1.AttributeNames.VARIABLES}${String(key)}`, variable); | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function addInputVariableAttributes(span, variableValues) { | ||
Object.entries(variableValues).forEach(([key, value]) => { | ||
addInputVariableAttribute(span, key, value); | ||
}); | ||
} | ||
exports.addInputVariableAttributes = addInputVariableAttributes; | ||
function addSpanSource(span, loc, allowValues, start, end) { | ||
@@ -27,0 +50,0 @@ const source = getSourceFromLocation(loc, allowValues, start, end); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.26.0"; | ||
export declare const VERSION = "0.26.1"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.26.0'; | ||
exports.VERSION = '0.26.1'; | ||
//# sourceMappingURL=version.js.map |
# Changelog | ||
### [0.26.1](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-graphql-v0.26.0...instrumentation-graphql-v0.26.1) (2021-11-12) | ||
### Bug Fixes | ||
* adding nested input variables in graphql plugin ([#720](https://www.github.com/open-telemetry/opentelemetry-js-contrib/issues/720)) ([7a7d3a3](https://www.github.com/open-telemetry/opentelemetry-js-contrib/commit/7a7d3a35e66678cf7d11fb9c89b8a26f2d4bfd6b)) | ||
## [0.26.0](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-graphql-v0.25.0...instrumentation-graphql-v0.26.0) (2021-10-22) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "@opentelemetry/instrumentation-graphql", | ||
"version": "0.26.0", | ||
"version": "0.26.1", | ||
"description": "OpenTelemetry @opentelemetry/instrumentation-graphql automatic instrumentation package.", | ||
@@ -51,3 +51,3 @@ "main": "build/src/index.js", | ||
"@opentelemetry/api": "1.0.2", | ||
"@opentelemetry/sdk-trace-base": "1.0.0", | ||
"@opentelemetry/sdk-trace-base": "1.0.1", | ||
"@types/mocha": "8.2.3", | ||
@@ -68,3 +68,3 @@ "@types/node": "14.17.9", | ||
}, | ||
"gitHead": "f80834b97bd8e5b1f78923b40fd69d60691c6ff4" | ||
"gitHead": "089e3cb3582b95b08133900002d39ad1da91277d" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76768
942