Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-tracing

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-tracing - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

46

lib/index.js
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc