applicationinsights
Advanced tools
Comparing version 1.2.0 to 1.3.0
import CorrelationContextManager = require("./AutoCollection/CorrelationContextManager"); | ||
import QuickPulseClient = require("./Library/QuickPulseStateManager"); | ||
export import TelemetryClient = require("./Library/NodeClient"); | ||
@@ -9,2 +10,3 @@ export import Contracts = require("./Declarations/Contracts"); | ||
export declare let defaultClient: TelemetryClient; | ||
export declare let liveMetricsClient: QuickPulseClient; | ||
/** | ||
@@ -110,2 +112,7 @@ * Initializes the default client. Should be called after setting | ||
static setInternalLogging(enableDebugLogging?: boolean, enableWarningLogging?: boolean): typeof Configuration; | ||
/** | ||
* Enables communication with Application Insights Live Metrics. | ||
* @param enable if true, enables communication with the live metrics service | ||
*/ | ||
static setSendLiveMetrics(enable?: boolean): typeof Configuration; | ||
} | ||
@@ -112,0 +119,0 @@ /** |
@@ -10,2 +10,3 @@ "use strict"; | ||
var Logging = require("./Library/Logging"); | ||
var QuickPulseClient = require("./Library/QuickPulseStateManager"); | ||
// We export these imports so that SDK users may use these classes directly. | ||
@@ -25,2 +26,3 @@ // They're exposed using "export import" so that types are passed along as expected | ||
var _forceClsHooked; | ||
var _isSendingLiveMetrics = false; // Off by default | ||
var _diskRetryInterval = undefined; | ||
@@ -34,2 +36,3 @@ var _diskRetryMaxBytes = undefined; | ||
var _isStarted = false; | ||
var _performanceLiveMetrics; | ||
/** | ||
@@ -78,2 +81,5 @@ * Initializes the default client. Should be called after setting | ||
_clientRequests.enable(_isDependencies); | ||
if (exports.liveMetricsClient && _isSendingLiveMetrics) { | ||
exports.liveMetricsClient.enable(_isSendingLiveMetrics); | ||
} | ||
} | ||
@@ -231,2 +237,27 @@ else { | ||
}; | ||
/** | ||
* Enables communication with Application Insights Live Metrics. | ||
* @param enable if true, enables communication with the live metrics service | ||
*/ | ||
Configuration.setSendLiveMetrics = function (enable) { | ||
if (enable === void 0) { enable = false; } | ||
if (!exports.defaultClient) { | ||
// Need a defaultClient so that we can add the QPS telemetry processor to it | ||
Logging.warn("Live metrics client cannot be setup without the default client"); | ||
return Configuration; | ||
} | ||
if (!exports.liveMetricsClient) { | ||
// No qps client exists. Create one and prepare it to be enabled at .start() | ||
exports.liveMetricsClient = new QuickPulseClient(exports.defaultClient.config.instrumentationKey); | ||
_performanceLiveMetrics = new AutoCollectPerformance(exports.liveMetricsClient, 1000, true); | ||
exports.liveMetricsClient.addCollector(_performanceLiveMetrics); | ||
exports.defaultClient.quickPulseClient = exports.liveMetricsClient; // Need this so we can forward all manual tracks to live metrics via quickPulseTelemetryProcessor | ||
_isSendingLiveMetrics = enable; | ||
} | ||
else { | ||
// qps client already exists; enable/disable it | ||
exports.liveMetricsClient.enable(enable); | ||
} | ||
return Configuration; | ||
}; | ||
// Convenience shortcut to ApplicationInsights.start | ||
@@ -233,0 +264,0 @@ Configuration.start = start; |
@@ -0,0 +0,0 @@ import TelemetryClient = require("../Library/TelemetryClient"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
import TelemetryClient = require("../../Library/TelemetryClient"); | ||
export declare function enable(enabled: boolean, client: TelemetryClient): void; |
@@ -0,0 +0,0 @@ "use strict"; |
import TelemetryClient = require("../../Library/TelemetryClient"); | ||
export declare function enable(enabled: boolean, client: TelemetryClient): void; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare const IsInitialized: boolean; | ||
export declare function registerContextPreservation(cb: (cb: Function) => Function): void; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import TelemetryClient = require("../../Library/TelemetryClient"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import TelemetryClient = require("../../Library/TelemetryClient"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import TelemetryClient = require("../../Library/TelemetryClient"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import TelemetryClient = require("../../Library/TelemetryClient"); |
@@ -0,0 +0,0 @@ "use strict"; |
import TelemetryClient = require("../../Library/TelemetryClient"); | ||
export declare function enable(enabled: boolean, client: TelemetryClient): void; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import TelemetryClient = require("../Library/TelemetryClient"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Contracts = require("../Declarations/Contracts"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Contracts = require("../Declarations/Contracts"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -9,2 +9,10 @@ /// <reference types="node" /> | ||
private static _lastRequestExecutionTime; | ||
private static _totalDependencyCount; | ||
private static _totalFailedDependencyCount; | ||
private static _lastDependencyExecutionTime; | ||
private static _totalExceptionCount; | ||
private static _intervalDependencyExecutionTime; | ||
private static _intervalRequestExecutionTime; | ||
private _enableLiveMetricsCounters; | ||
private _collectionInterval; | ||
private _client; | ||
@@ -17,6 +25,13 @@ private _handle; | ||
private _lastCpus; | ||
private _lastDependencies; | ||
private _lastRequests; | ||
constructor(client: TelemetryClient); | ||
enable(isEnabled: boolean): void; | ||
private _lastExceptions; | ||
/** | ||
* @param enableLiveMetricsCounters - enable sending additional live metrics information (dependency metrics, exception metrics, committed memory) | ||
*/ | ||
constructor(client: TelemetryClient, collectionInterval?: number, enableLiveMetricsCounters?: boolean); | ||
enable(isEnabled: boolean, collectionInterval?: number): void; | ||
static countRequest(request: http.ServerRequest, response: http.ServerResponse): void; | ||
static countException(): void; | ||
static countDependency(duration: number | string, success: boolean): void; | ||
isInitialized(): boolean; | ||
@@ -28,4 +43,6 @@ static isEnabled(): boolean; | ||
private _trackNetwork(); | ||
private _trackDependencyRate(); | ||
private _trackExceptionRate(); | ||
dispose(): void; | ||
} | ||
export = AutoCollectPerformance; |
"use strict"; | ||
var os = require("os"); | ||
var Logging = require("../Library/Logging"); | ||
var Constants = require("../Declarations/Constants"); | ||
var AutoCollectPerformance = (function () { | ||
function AutoCollectPerformance(client) { | ||
if (!!AutoCollectPerformance.INSTANCE) { | ||
throw new Error("Performance tracking should be configured from the applicationInsights object"); | ||
/** | ||
* @param enableLiveMetricsCounters - enable sending additional live metrics information (dependency metrics, exception metrics, committed memory) | ||
*/ | ||
function AutoCollectPerformance(client, collectionInterval, enableLiveMetricsCounters) { | ||
if (collectionInterval === void 0) { collectionInterval = 60000; } | ||
if (enableLiveMetricsCounters === void 0) { enableLiveMetricsCounters = false; } | ||
if (!AutoCollectPerformance.INSTANCE) { | ||
AutoCollectPerformance.INSTANCE = this; | ||
} | ||
AutoCollectPerformance.INSTANCE = this; | ||
this._isInitialized = false; | ||
this._client = client; | ||
this._collectionInterval = collectionInterval; | ||
this._enableLiveMetricsCounters = enableLiveMetricsCounters; | ||
} | ||
AutoCollectPerformance.prototype.enable = function (isEnabled) { | ||
AutoCollectPerformance.prototype.enable = function (isEnabled, collectionInterval) { | ||
var _this = this; | ||
@@ -27,2 +34,11 @@ this._isEnabled = isEnabled; | ||
}; | ||
this._lastDependencies = { | ||
totalDependencyCount: AutoCollectPerformance._totalDependencyCount, | ||
totalFailedDependencyCount: AutoCollectPerformance._totalFailedDependencyCount, | ||
time: +new Date | ||
}; | ||
this._lastExceptions = { | ||
totalExceptionCount: AutoCollectPerformance._totalExceptionCount, | ||
time: +new Date | ||
}; | ||
if (typeof process.cpuUsage === 'function') { | ||
@@ -32,3 +48,4 @@ this._lastAppCpuUsage = process.cpuUsage(); | ||
this._lastHrtime = process.hrtime(); | ||
this._handle = setInterval(function () { return _this.trackPerformance(); }, 60000); | ||
this._collectionInterval = collectionInterval || this._collectionInterval; | ||
this._handle = setInterval(function () { return _this.trackPerformance(); }, this._collectionInterval); | ||
this._handle.unref(); // Allow the app to terminate even while this loop is going on | ||
@@ -58,3 +75,3 @@ } | ||
var end = +new Date; | ||
_this._lastRequestExecutionTime = end - start; | ||
AutoCollectPerformance._intervalRequestExecutionTime += _this._lastRequestExecutionTime = end - start; | ||
AutoCollectPerformance._totalRequestCount++; | ||
@@ -67,2 +84,26 @@ if (response.statusCode >= 400) { | ||
}; | ||
AutoCollectPerformance.countException = function () { | ||
AutoCollectPerformance._totalExceptionCount++; | ||
}; | ||
AutoCollectPerformance.countDependency = function (duration, success) { | ||
var durationMs; | ||
if (!AutoCollectPerformance.isEnabled()) { | ||
return; | ||
} | ||
if (typeof duration === 'string') { | ||
// dependency duration is passed in as "00:00:00.123" by autocollectors | ||
durationMs = +new Date('1970-01-01T' + duration + 'Z'); // convert to num ms, returns NaN if wrong | ||
} | ||
else if (typeof duration === 'number') { | ||
durationMs = duration; | ||
} | ||
else { | ||
return; | ||
} | ||
AutoCollectPerformance._intervalDependencyExecutionTime += durationMs; | ||
if (success === false) { | ||
AutoCollectPerformance._totalFailedDependencyCount++; | ||
} | ||
AutoCollectPerformance._totalDependencyCount++; | ||
}; | ||
AutoCollectPerformance.prototype.isInitialized = function () { | ||
@@ -78,2 +119,4 @@ return this._isInitialized; | ||
this._trackNetwork(); | ||
this._trackDependencyRate(); | ||
this._trackExceptionRate(); | ||
}; | ||
@@ -129,4 +172,4 @@ AutoCollectPerformance.prototype._trackCpu = function () { | ||
var combinedTotal = (totalUser + totalSys + totalNice + totalIdle + totalIrq) || 1; | ||
this._client.trackMetric({ name: "\\Processor(_Total)\\% Processor Time", value: ((combinedTotal - totalIdle) / combinedTotal) * 100 }); | ||
this._client.trackMetric({ name: "\\Process(??APP_WIN32_PROC??)\\% Processor Time", value: appCpuPercent || ((totalUser / combinedTotal) * 100) }); | ||
this._client.trackMetric({ name: Constants.PerformanceCounter.PROCESSOR_TIME, value: ((combinedTotal - totalIdle) / combinedTotal) * 100 }); | ||
this._client.trackMetric({ name: Constants.PerformanceCounter.PROCESS_TIME, value: appCpuPercent || ((totalUser / combinedTotal) * 100) }); | ||
} | ||
@@ -138,4 +181,9 @@ this._lastCpus = cpus; | ||
var usedMem = process.memoryUsage().rss; | ||
this._client.trackMetric({ name: "\\Process(??APP_WIN32_PROC??)\\Private Bytes", value: usedMem }); | ||
this._client.trackMetric({ name: "\\Memory\\Available Bytes", value: freeMem }); | ||
var committedMemory = os.totalmem() - freeMem; | ||
this._client.trackMetric({ name: Constants.PerformanceCounter.PRIVATE_BYTES, value: usedMem }); | ||
this._client.trackMetric({ name: Constants.PerformanceCounter.AVAILABLE_BYTES, value: freeMem }); | ||
// Only supported by quickpulse service | ||
if (this._enableLiveMetricsCounters) { | ||
this._client.trackMetric({ name: Constants.QuickPulseCounter.COMMITTED_BYTES, value: committedMemory }); | ||
} | ||
}; | ||
@@ -154,10 +202,68 @@ AutoCollectPerformance.prototype._trackNetwork = function () { | ||
var elapsedSeconds = elapsedMs / 1000; | ||
var averageRequestExecutionTime = AutoCollectPerformance._intervalRequestExecutionTime / intervalRequests; | ||
AutoCollectPerformance._intervalRequestExecutionTime = 0; // reset | ||
if (elapsedMs > 0) { | ||
var requestsPerSec = intervalRequests / elapsedSeconds; | ||
var failedRequestsPerSec = intervalFailedRequests / elapsedSeconds; | ||
this._client.trackMetric({ name: "\\ASP.NET Applications(??APP_W3SVC_PROC??)\\Requests/Sec", value: requestsPerSec }); | ||
this._client.trackMetric({ name: "\\ASP.NET Applications(??APP_W3SVC_PROC??)\\Request Execution Time", value: AutoCollectPerformance._lastRequestExecutionTime }); | ||
this._client.trackMetric({ name: Constants.PerformanceCounter.REQUEST_RATE, value: requestsPerSec }); | ||
// Only send duration to live metrics if it has been updated! | ||
if (!this._enableLiveMetricsCounters || intervalRequests > 0) { | ||
this._client.trackMetric({ name: Constants.PerformanceCounter.REQUEST_DURATION, value: averageRequestExecutionTime }); | ||
} | ||
// Only supported by quickpulse service | ||
if (this._enableLiveMetricsCounters) { | ||
this._client.trackMetric({ name: Constants.QuickPulseCounter.REQUEST_FAILURE_RATE, value: failedRequestsPerSec }); | ||
} | ||
} | ||
this._lastRequests = requests; | ||
}; | ||
// Static counter is accumulated externally. Report the rate to client here | ||
// Note: This is currently only used with QuickPulse client | ||
AutoCollectPerformance.prototype._trackDependencyRate = function () { | ||
if (this._enableLiveMetricsCounters) { | ||
var lastDependencies = this._lastDependencies; | ||
var dependencies = { | ||
totalDependencyCount: AutoCollectPerformance._totalDependencyCount, | ||
totalFailedDependencyCount: AutoCollectPerformance._totalFailedDependencyCount, | ||
time: +new Date | ||
}; | ||
var intervalDependencies = (dependencies.totalDependencyCount - lastDependencies.totalDependencyCount) || 0; | ||
var intervalFailedDependencies = (dependencies.totalFailedDependencyCount - lastDependencies.totalFailedDependencyCount) || 0; | ||
var elapsedMs = dependencies.time - lastDependencies.time; | ||
var elapsedSeconds = elapsedMs / 1000; | ||
var averageDependencyExecutionTime = AutoCollectPerformance._intervalDependencyExecutionTime / intervalDependencies; | ||
AutoCollectPerformance._intervalDependencyExecutionTime = 0; // reset | ||
if (elapsedMs > 0) { | ||
var dependenciesPerSec = intervalDependencies / elapsedSeconds; | ||
var failedDependenciesPerSec = intervalFailedDependencies / elapsedSeconds; | ||
this._client.trackMetric({ name: Constants.QuickPulseCounter.DEPENDENCY_RATE, value: dependenciesPerSec }); | ||
this._client.trackMetric({ name: Constants.QuickPulseCounter.DEPENDENCY_FAILURE_RATE, value: failedDependenciesPerSec }); | ||
// redundant check for livemetrics, but kept for consistency w/ requests | ||
// Only send duration to live metrics if it has been updated! | ||
if (!this._enableLiveMetricsCounters || intervalDependencies > 0) { | ||
this._client.trackMetric({ name: Constants.QuickPulseCounter.DEPENDENCY_DURATION, value: averageDependencyExecutionTime }); | ||
} | ||
} | ||
this._lastDependencies = dependencies; | ||
} | ||
}; | ||
// Static counter is accumulated externally. Report the rate to client here | ||
// Note: This is currently only used with QuickPulse client | ||
AutoCollectPerformance.prototype._trackExceptionRate = function () { | ||
if (this._enableLiveMetricsCounters) { | ||
var lastExceptions = this._lastExceptions; | ||
var exceptions = { | ||
totalExceptionCount: AutoCollectPerformance._totalExceptionCount, | ||
time: +new Date | ||
}; | ||
var intervalExceptions = (exceptions.totalExceptionCount - lastExceptions.totalExceptionCount) || 0; | ||
var elapsedMs = exceptions.time - lastExceptions.time; | ||
var elapsedSeconds = elapsedMs / 1000; | ||
if (elapsedMs > 0) { | ||
var exceptionsPerSec = intervalExceptions / elapsedSeconds; | ||
this._client.trackMetric({ name: Constants.QuickPulseCounter.EXCEPTION_RATE, value: exceptionsPerSec }); | ||
} | ||
this._lastExceptions = exceptions; | ||
} | ||
}; | ||
AutoCollectPerformance.prototype.dispose = function () { | ||
@@ -171,2 +277,8 @@ AutoCollectPerformance.INSTANCE = null; | ||
AutoCollectPerformance._lastRequestExecutionTime = 0; | ||
AutoCollectPerformance._totalDependencyCount = 0; | ||
AutoCollectPerformance._totalFailedDependencyCount = 0; | ||
AutoCollectPerformance._lastDependencyExecutionTime = 0; | ||
AutoCollectPerformance._totalExceptionCount = 0; | ||
AutoCollectPerformance._intervalDependencyExecutionTime = 0; | ||
AutoCollectPerformance._intervalRequestExecutionTime = 0; | ||
return AutoCollectPerformance; | ||
@@ -173,0 +285,0 @@ }()); |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { Domain } from "./Generated"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Domain = require('./Domain'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ // THIS FILE WAS AUTOGENERATED |
@@ -0,0 +0,0 @@ declare class ContextTagKeys { |
@@ -0,0 +0,0 @@ // THIS FILE WAS AUTOGENERATED |
@@ -0,0 +0,0 @@ import Base = require('./Base'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import DataPointType = require('./DataPointType'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ // THIS FILE WAS AUTOGENERATED |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ // THIS FILE WAS AUTOGENERATED |
@@ -0,0 +0,0 @@ import Base = require('./Base'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Domain = require('./Domain'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Domain = require('./Domain'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import StackFrame = require('./StackFrame'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export import AvailabilityData = require("./AvailabilityData"); |
@@ -0,0 +0,0 @@ // THIS FILE WAS AUTOGENERATED |
@@ -0,0 +0,0 @@ import Domain = require('./Domain'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Domain = require('./Domain'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import EventData = require('./EventData'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Domain = require('./Domain'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Domain = require('./Domain'); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ // THIS FILE WAS AUTOGENERATED |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ // THIS FILE WAS AUTOGENERATED |
export * from "./Constants"; | ||
export * from "./Generated"; | ||
export * from "./TelemetryTypes"; | ||
export * from "./QuickPulseTypes"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { Telemetry } from "./Telemetry"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=DependencyTelemetry.js.map |
@@ -0,0 +0,0 @@ import { Telemetry } from "./Telemetry"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=EventTelemetry.js.map |
@@ -0,0 +0,0 @@ import { Telemetry } from "./Telemetry"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=ExceptionTelemetry.js.map |
@@ -0,0 +0,0 @@ export * from "./DependencyTelemetry"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { Telemetry } from "./Telemetry"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=MetricTelemetry.js.map |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=NodeHttpDependencyTelemetry.js.map |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=NodeHttpRequestTelemetry.js.map |
@@ -0,0 +0,0 @@ import { Telemetry } from "./Telemetry"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=RequestTelemetry.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=Telemetry.js.map |
@@ -0,1 +1,3 @@ | ||
export declare type TelemetryTypeKeys = "Event" | "Exception" | "Trace" | "Metric" | "Request" | "Dependency"; | ||
export declare type TelemetryTypeValues = "EventData" | "ExceptionData" | "MessageData" | "MetricData" | "RequestData" | "RemoteDependencyData"; | ||
/** | ||
@@ -5,3 +7,3 @@ * Converts the user-friendly enumeration TelemetryType to the underlying schema baseType value | ||
*/ | ||
export declare function telemetryTypeToBaseType(type: TelemetryType): string; | ||
export declare function telemetryTypeToBaseType(type: TelemetryType): TelemetryTypeValues; | ||
/** | ||
@@ -11,3 +13,6 @@ * Converts the schema baseType value to the user-friendly enumeration TelemetryType | ||
*/ | ||
export declare function baseTypeToTelemetryType(baseType: string): TelemetryType; | ||
export declare function baseTypeToTelemetryType(baseType: TelemetryTypeValues): TelemetryType; | ||
export declare const TelemetryTypeString: { | ||
[key: string]: TelemetryTypeValues; | ||
}; | ||
/** | ||
@@ -14,0 +19,0 @@ * Telemetry types supported by this SDK |
@@ -47,2 +47,10 @@ "use strict"; | ||
exports.baseTypeToTelemetryType = baseTypeToTelemetryType; | ||
exports.TelemetryTypeString = { | ||
Event: "EventData", | ||
Exception: "ExceptionData", | ||
Trace: "MessageData", | ||
Metric: "MetricData", | ||
Request: "RequestData", | ||
Dependency: "RemoteDependencyData" | ||
}; | ||
/** | ||
@@ -49,0 +57,0 @@ * Telemetry types supported by this SDK |
@@ -0,0 +0,0 @@ import { Telemetry } from "./Telemetry"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=TraceTelemetry.js.map |
@@ -29,4 +29,4 @@ import Contracts = require("../Declarations/Contracts"); | ||
triggerSend(isNodeCrashing: boolean, callback?: (v: string) => void): void; | ||
private _stringify(envelope); | ||
protected _stringify(envelope: Contracts.Envelope): string; | ||
} | ||
export = Channel; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -9,2 +9,3 @@ /// <reference types="node" /> | ||
static ENV_profileQueryEndpoint: string; | ||
static ENV_quickPulseHost: string; | ||
static ENV_http_proxy: string; | ||
@@ -41,6 +42,9 @@ static ENV_https_proxy: string; | ||
private _profileQueryEndpoint; | ||
/** Host name for quickpulse service */ | ||
private _quickPulseHost; | ||
constructor(instrumentationKey?: string); | ||
profileQueryEndpoint: string; | ||
quickPulseHost: string; | ||
private static _getInstrumentationKey(); | ||
} | ||
export = Config; |
@@ -26,2 +26,3 @@ "use strict"; | ||
this.httpsAgent = undefined; | ||
this._quickPulseHost = process.env[Config.ENV_quickPulseHost] || "rt.services.visualstudio.com"; | ||
} | ||
@@ -41,2 +42,12 @@ Object.defineProperty(Config.prototype, "profileQueryEndpoint", { | ||
}); | ||
Object.defineProperty(Config.prototype, "quickPulseHost", { | ||
get: function () { | ||
return this._quickPulseHost; | ||
}, | ||
set: function (host) { | ||
this._quickPulseHost = host; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Config._getInstrumentationKey = function () { | ||
@@ -59,2 +70,3 @@ // check for both the documented env variable and the azure-prefixed variable | ||
Config.ENV_profileQueryEndpoint = "APPINSIGHTS_PROFILE_QUERY_ENDPOINT"; | ||
Config.ENV_quickPulseHost = "APPINSIGHTS_QUICKPULSE_HOST"; | ||
Config.ENV_http_proxy = "http_proxy"; | ||
@@ -61,0 +73,0 @@ Config.ENV_https_proxy = "https_proxy"; |
@@ -0,0 +0,0 @@ import Contracts = require("../Declarations/Contracts"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Config = require("./Config"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Contracts = require("../Declarations/Contracts"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=FlushOptions.js.map |
@@ -0,0 +0,0 @@ declare class Logging { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import TelemetryClient = require("./TelemetryClient"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ declare const _default: { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -6,2 +6,3 @@ import Config = require("./Config"); | ||
import FlushOptions = require("./FlushOptions"); | ||
import QuickPulseStateManager = require("./QuickPulseStateManager"); | ||
/** | ||
@@ -19,2 +20,3 @@ * Application Insights telemetry client provides interface to track telemetry items, register telemetry initializers and | ||
channel: Channel; | ||
quickPulseClient: QuickPulseStateManager; | ||
/** | ||
@@ -21,0 +23,0 @@ * Constructs a new client of the client |
@@ -111,2 +111,3 @@ "use strict"; | ||
accepted = accepted && TelemetryProcessors.samplingTelemetryProcessor(envelope, { correlationContext: CorrelationContextManager_1.CorrelationContextManager.getCurrentContext() }); | ||
TelemetryProcessors.quickPulseTelemetryProcessor(envelope, this.quickPulseClient); | ||
if (accepted) { | ||
@@ -113,0 +114,0 @@ this.channel.send(envelope); |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
export * from "./SamplingTelemetryProcessor"; | ||
export * from "./QuickPulseTelemetryProcessor"; |
@@ -7,2 +7,3 @@ "use strict"; | ||
__export(require("./SamplingTelemetryProcessor")); | ||
__export(require("./QuickPulseTelemetryProcessor")); | ||
//# sourceMappingURL=index.js.map |
@@ -0,0 +0,0 @@ import Contracts = require("../Declarations/Contracts"); |
@@ -18,3 +18,3 @@ "use strict"; | ||
else if (contextObjects.correlationContext && contextObjects.correlationContext.operation) { | ||
// If we're using dependency correlation, sampling should retain all telemetry from a given request | ||
// If we're using dependency correlation, sampling should retain all telemetry from a given request | ||
isSampledIn = getSamplingHashCode(contextObjects.correlationContext.operation.id) < samplingPercentage; | ||
@@ -21,0 +21,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"bugs": "https://github.com/Microsoft/ApplicationInsights-node.js/issues", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Microsoft Application Insights module for Node.js", | ||
@@ -52,10 +52,10 @@ "repository": { | ||
"devDependencies": { | ||
"@types/cls-hooked": "^4.2.1", | ||
"@types/cls-hooked": "^4.3.0", | ||
"@types/mocha": "2.2.48", | ||
"@types/node": "4.2.4", | ||
"@types/sinon": "2.1.2", | ||
"typescript": "2.4.2", | ||
"mocha": "3.5.2", | ||
"node-mocks-http": "1.2.3", | ||
"sinon": "1.17.6" | ||
"sinon": "1.17.6", | ||
"typescript": "2.4.2" | ||
}, | ||
@@ -62,0 +62,0 @@ "dependencies": { |
@@ -114,2 +114,3 @@ # Application Insights for Node.js | ||
.setUseDiskRetryCaching(true) | ||
.setSendLiveMetrics(false) | ||
.start(); | ||
@@ -171,2 +172,7 @@ ``` | ||
### Live Metrics | ||
>***Note:*** The ability to send to live metrics was added in version `1.3.0`. | ||
To enable sending live metrics of your app to Azure, use `setSendLiveMetrics(true)`. Filtering of live metrics in the Portal is currently not supported. | ||
## Track custom telemetry | ||
@@ -173,0 +179,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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
321794
159
6731
427
14
8