apollo-tracing
Advanced tools
Comparing version 0.1.0 to 0.1.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const graphql_1 = require("graphql"); | ||
class TracingExtension { | ||
constructor() { | ||
var graphql_1 = require("graphql"); | ||
var TracingExtension = /** @class */ (function () { | ||
function TracingExtension() { | ||
this.resolverCalls = []; | ||
} | ||
requestDidStart() { | ||
TracingExtension.prototype.requestDidStart = function () { | ||
this.startWallTime = new Date(); | ||
this.startHrTime = process.hrtime(); | ||
} | ||
executionDidStart() { } | ||
willResolveField(_source, _args, _context, info) { | ||
const resolverCall = { | ||
}; | ||
TracingExtension.prototype.executionDidStart = function () { }; | ||
TracingExtension.prototype.willResolveField = function (_source, _args, _context, info) { | ||
var _this = this; | ||
var resolverCall = { | ||
path: info.path, | ||
@@ -22,12 +23,12 @@ fieldName: info.fieldName, | ||
this.resolverCalls.push(resolverCall); | ||
return () => { | ||
resolverCall.endOffset = process.hrtime(this.startHrTime); | ||
return function () { | ||
resolverCall.endOffset = process.hrtime(_this.startHrTime); | ||
}; | ||
} | ||
didResolveField(_source, _args, _context, info) { } | ||
requestDidEnd() { | ||
}; | ||
TracingExtension.prototype.didResolveField = function (_source, _args, _context, info) { }; | ||
TracingExtension.prototype.requestDidEnd = function () { | ||
this.duration = process.hrtime(this.startHrTime); | ||
this.endWallTime = new Date(); | ||
} | ||
format() { | ||
}; | ||
TracingExtension.prototype.format = function () { | ||
return [ | ||
@@ -41,5 +42,5 @@ "tracing", | ||
execution: { | ||
resolvers: this.resolverCalls.map(resolverCall => { | ||
const startOffset = durationHrTimeToNanos(resolverCall.startOffset); | ||
const duration = resolverCall.endOffset | ||
resolvers: this.resolverCalls.map(function (resolverCall) { | ||
var startOffset = durationHrTimeToNanos(resolverCall.startOffset); | ||
var duration = resolverCall.endOffset | ||
? durationHrTimeToNanos(resolverCall.endOffset) - startOffset | ||
@@ -52,4 +53,4 @@ : 0; | ||
returnType: resolverCall.returnType.toString(), | ||
startOffset, | ||
duration | ||
startOffset: startOffset, | ||
duration: duration | ||
}; | ||
@@ -60,4 +61,5 @@ }) | ||
]; | ||
} | ||
} | ||
}; | ||
return TracingExtension; | ||
}()); | ||
exports.TracingExtension = TracingExtension; | ||
@@ -64,0 +66,0 @@ // Converts an hrtime array (as returned from process.hrtime) to nanoseconds. |
{ | ||
"name": "apollo-tracing", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Collect and expose trace data for GraphQL requests", | ||
@@ -29,4 +29,4 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"graphql-extensions": "^0.0.4" | ||
"graphql-extensions": "^0.0.x" | ||
} | ||
} |
{ | ||
"compilerOptions": { | ||
"target": "es2015", | ||
"target": "es5", | ||
"module": "commonjs", | ||
@@ -5,0 +5,0 @@ "moduleResolution": "node", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10485
126
0
+ Addedgraphql-extensions@0.0.10(transitive)
- Removedgraphql-extensions@0.0.4(transitive)
Updatedgraphql-extensions@^0.0.x