UNPKG

@azure/monitor-opentelemetry-exporter

Version:

Application Insights exporter for the OpenTelemetry JavaScript (Node.js) SDK

89 lines 3.33 kB
"use strict"; /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ApplicationInsightsClient = void 0; const tslib_1 = require("tslib"); const coreClient = tslib_1.__importStar(require("@azure/core-client")); const Parameters = tslib_1.__importStar(require("./models/parameters.js")); const Mappers = tslib_1.__importStar(require("./models/mappers.js")); class ApplicationInsightsClient extends coreClient.ServiceClient { /** * Initializes a new instance of the ApplicationInsightsClient class. * @param options The parameter options */ constructor(options) { var _a, _b; // Initializing default values for options if (!options) { options = {}; } const defaults = { requestContentType: "application/json; charset=utf-8", }; const packageDetails = `azsdk-js-monitor-opentelemetry-exporter/1.0.0-beta.29`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: { userAgentPrefix, }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{Host}/v2.1" }); super(optionsWithDefaults); // Assigning values to Constant parameters this.host = options.host || "https://dc.services.visualstudio.com"; } /** * This operation sends a sequence of telemetry events that will be monitored by Azure Monitor. * @param body The list of telemetry events to track. * @param options The options parameters. */ track(body, options) { return this.sendOperationRequest({ body, options }, trackOperationSpec); } } exports.ApplicationInsightsClient = ApplicationInsightsClient; // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const trackOperationSpec = { path: "/track", httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.TrackResponse, }, 206: { bodyMapper: Mappers.TrackResponse, }, 400: { bodyMapper: Mappers.TrackResponse, isError: true, }, 402: { bodyMapper: Mappers.TrackResponse, isError: true, }, 429: { bodyMapper: Mappers.TrackResponse, isError: true, }, 500: { bodyMapper: Mappers.TrackResponse, isError: true, }, 503: { bodyMapper: Mappers.TrackResponse, isError: true, }, }, requestBody: Parameters.body, urlParameters: [Parameters.host], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", serializer, }; //# sourceMappingURL=applicationInsightsClient.js.map