@opencensus/instrumentation-http
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -17,4 +17,3 @@ /// <reference types="node" /> | ||
*/ | ||
import { types } from '@opencensus/opencensus-core'; | ||
import { classes } from '@opencensus/opencensus-core'; | ||
import { BasePlugin, Func } from '@opencensus/core'; | ||
import * as httpModule from 'http'; | ||
@@ -24,3 +23,3 @@ export declare type HttpModule = typeof httpModule; | ||
/** Http instrumentation plugin for Opencensus */ | ||
export declare class HttpPlugin extends classes.BasePlugin { | ||
export declare class HttpPlugin extends BasePlugin { | ||
/** | ||
@@ -54,3 +53,3 @@ * Attributes Names according to Opencensus HTTP Specs | ||
*/ | ||
protected getPatchOutgoingRequestFunction(): (original: types.Func<httpModule.ClientRequest>) => types.Func<httpModule.ClientRequest>; | ||
protected getPatchOutgoingRequestFunction(): (original: Func<httpModule.ClientRequest>) => Func<httpModule.ClientRequest>; | ||
/** | ||
@@ -57,0 +56,0 @@ * Injects span's context to header for distributed tracing and finshes the |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const opencensus_core_1 = require("@opencensus/opencensus-core"); | ||
const core_1 = require("@opencensus/core"); | ||
const semver = require("semver"); | ||
@@ -25,3 +25,3 @@ const shimmer = require("shimmer"); | ||
/** Http instrumentation plugin for Opencensus */ | ||
class HttpPlugin extends opencensus_core_1.classes.BasePlugin { | ||
class HttpPlugin extends core_1.BasePlugin { | ||
/** Constructs a new HttpPlugin instance. */ | ||
@@ -181,6 +181,5 @@ constructor(moduleName) { | ||
plugin.logger.debug('makeRequestTrace'); | ||
const headers = options.headers; | ||
const setter = { | ||
setHeader(name, value) { | ||
headers[name] = value; | ||
request.setHeader(name, value); | ||
} | ||
@@ -202,2 +201,3 @@ }; | ||
const method = response.method ? response.method : 'GET'; | ||
const headers = options.headers; | ||
const userAgent = headers ? (headers['user-agent'] || headers['User-Agent']) : null; | ||
@@ -224,2 +224,8 @@ span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_HOST, options.hostname); | ||
}); | ||
request.on('error', error => { | ||
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_NAME, error.name); | ||
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_MESSAGE, error.message); | ||
span.status = TraceStatusCodes.UNKNOWN; | ||
span.end(); | ||
}); | ||
plugin.logger.debug('makeRequestTrace retun request'); | ||
@@ -226,0 +232,0 @@ return request; |
{ | ||
"name": "@opencensus/instrumentation-http", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Opencensus http automatic instrumentation package.", | ||
@@ -58,3 +58,3 @@ "main": "build/src/index.js", | ||
"dependencies": { | ||
"@opencensus/opencensus-core": "^0.0.2", | ||
"@opencensus/core": "^0.0.3", | ||
"end-of-stream": "^1.4.1", | ||
@@ -61,0 +61,0 @@ "semver": "^5.5.0", |
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
32745
414
+ Added@opencensus/core@^0.0.3
+ Added@opencensus/core@0.0.3(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedhdr-histogram-js@1.2.0(transitive)
+ Addedpako@1.0.11(transitive)
- Removed@opencensus/opencensus-core@^0.0.2
- Removed@opencensus/opencensus-core@0.0.2(transitive)
- Removeddebug@3.2.7(transitive)
- Removedintercept-stdout@0.1.2(transitive)
- Removedlodash._arraycopy@3.0.0(transitive)
- Removedlodash._basevalues@3.0.0(transitive)
- Removedlodash._getnative@3.9.1(transitive)
- Removedlodash.isarguments@3.1.0(transitive)
- Removedlodash.isarray@3.0.4(transitive)
- Removedlodash.keys@3.1.2(transitive)
- Removedlodash.toarray@3.0.2(transitive)
- Removedms@2.1.3(transitive)