@azure/monitor-opentelemetry
Version:
Azure Monitor OpenTelemetry (Node.js)
26 lines • 1.33 kB
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.createQuickpulse = createQuickpulse;
const logger_js_1 = require("../logger.js");
const core_client_1 = require("@azure-rest/core-client");
/** Live Metrics REST APIs. */
function createQuickpulse(credential, options = {}) {
const endpointUrl = options.endpoint ?? "https://global.livediagnostics.monitor.azure.com";
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
const userAgentInfo = `azsdk-js-livemetrics/1.0.0-beta.1`;
const userAgentPrefix = prefixFromOptions
? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
: `azsdk-js-api ${userAgentInfo}`;
const { apiVersion: _, ...updatedOptions } = {
...options,
userAgentOptions: { userAgentPrefix },
loggingOptions: { logger: options.loggingOptions?.logger ?? logger_js_1.logger.info },
credentials: { scopes: options.credentials?.scopes ?? ["https://monitor.azure.com/.default"] },
};
const clientContext = (0, core_client_1.getClient)(endpointUrl, credential, updatedOptions);
const apiVersion = options.apiVersion;
return { ...clientContext, apiVersion };
}
//# sourceMappingURL=quickpulseContext.js.map