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

@opentelemetry/sdk-metrics

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/sdk-metrics - npm Package Compare versions

Comparing version 1.27.0 to 1.28.0

44

build/esm/export/PeriodicExportingMetricReader.js

@@ -96,3 +96,2 @@ /*

import { callWithTimeout, TimeoutError } from '../utils';
import { diag } from '@opentelemetry/api';
/**

@@ -156,5 +155,4 @@ * {@link MetricReader} which collects metrics based on a user-configurable time interval, and passes the metrics to

return __awaiter(this, void 0, void 0, function () {
var _c, resourceMetrics, errors, doExport;
var _c, resourceMetrics, errors, e_1, result;
var _d;
var _this = this;
return __generator(this, function (_e) {

@@ -170,26 +168,22 @@ switch (_e.label) {

}
doExport = function () { return __awaiter(_this, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, internal._export(this._exporter, resourceMetrics)];
case 1:
result = _a.sent();
if (result.code !== ExportResultCode.SUCCESS) {
throw new Error("PeriodicExportingMetricReader: metrics export failed (error " + result.error + ")");
}
return [2 /*return*/];
}
});
}); };
if (!resourceMetrics.resource.asyncAttributesPending) return [3 /*break*/, 2];
(_b = (_a = resourceMetrics.resource).waitForAsyncAttributes) === null || _b === void 0 ? void 0 : _b.call(_a).then(doExport, function (err) {
return diag.debug('Error while resolving async portion of resource: ', err);
}).catch(globalErrorHandler);
return [3 /*break*/, 4];
case 2: return [4 /*yield*/, doExport()];
if (!resourceMetrics.resource.asyncAttributesPending) return [3 /*break*/, 5];
_e.label = 2;
case 2:
_e.trys.push([2, 4, , 5]);
return [4 /*yield*/, ((_b = (_a = resourceMetrics.resource).waitForAsyncAttributes) === null || _b === void 0 ? void 0 : _b.call(_a))];
case 3:
_e.sent();
_e.label = 4;
case 4: return [2 /*return*/];
return [3 /*break*/, 5];
case 4:
e_1 = _e.sent();
api.diag.debug('Error while resolving async portion of resource: ', e_1);
globalErrorHandler(e_1);
return [3 /*break*/, 5];
case 5: return [4 /*yield*/, internal._export(this._exporter, resourceMetrics)];
case 6:
result = _e.sent();
if (result.code !== ExportResultCode.SUCCESS) {
throw new Error("PeriodicExportingMetricReader: metrics export failed (error " + result.error + ")");
}
return [2 /*return*/];
}

@@ -196,0 +190,0 @@ });

@@ -14,2 +14,7 @@ import { MeterProvider as IMeterProvider, Meter as IMeter, MeterOptions } from '@opentelemetry/api';

readers?: MetricReader[];
/**
* Merge resource with {@link Resource.default()}?
* Default: {@code true}
*/
mergeResourceWithDefaults?: boolean;
}

@@ -16,0 +21,0 @@ /**

@@ -68,2 +68,13 @@ /*

/**
* @param mergeWithDefaults
* @param providedResource
*/
function prepareResource(mergeWithDefaults, providedResource) {
var resource = providedResource !== null && providedResource !== void 0 ? providedResource : Resource.empty();
if (mergeWithDefaults) {
return Resource.default().merge(resource);
}
return resource;
}
/**
* This class implements the {@link MeterProvider} interface.

@@ -76,4 +87,3 @@ */

this._shutdown = false;
var resource = Resource.default().merge((_c = options === null || options === void 0 ? void 0 : options.resource) !== null && _c !== void 0 ? _c : Resource.empty());
this._sharedState = new MeterProviderSharedState(resource);
this._sharedState = new MeterProviderSharedState(prepareResource((_c = options === null || options === void 0 ? void 0 : options.mergeResourceWithDefaults) !== null && _c !== void 0 ? _c : true, options === null || options === void 0 ? void 0 : options.resource));
if ((options === null || options === void 0 ? void 0 : options.views) != null && options.views.length > 0) {

@@ -80,0 +90,0 @@ try {

@@ -1,2 +0,2 @@

export declare const VERSION = "1.27.0";
export declare const VERSION = "1.28.0";
//# sourceMappingURL=version.d.ts.map

@@ -17,3 +17,3 @@ /*

// this is autogenerated file, see scripts/version-update.js
export var VERSION = '1.27.0';
export var VERSION = '1.28.0';
//# sourceMappingURL=version.js.map

@@ -20,3 +20,2 @@ /*

import { callWithTimeout, TimeoutError } from '../utils';
import { diag } from '@opentelemetry/api';
/**

@@ -71,14 +70,14 @@ * {@link MetricReader} which collects metrics based on a user-configurable time interval, and passes the metrics to

}
const doExport = async () => {
const result = await internal._export(this._exporter, resourceMetrics);
if (result.code !== ExportResultCode.SUCCESS) {
throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${result.error})`);
if (resourceMetrics.resource.asyncAttributesPending) {
try {
await ((_b = (_a = resourceMetrics.resource).waitForAsyncAttributes) === null || _b === void 0 ? void 0 : _b.call(_a));
}
};
// Avoid scheduling a promise to make the behavior more predictable and easier to test
if (resourceMetrics.resource.asyncAttributesPending) {
(_b = (_a = resourceMetrics.resource).waitForAsyncAttributes) === null || _b === void 0 ? void 0 : _b.call(_a).then(doExport, err => diag.debug('Error while resolving async portion of resource: ', err)).catch(globalErrorHandler);
catch (e) {
api.diag.debug('Error while resolving async portion of resource: ', e);
globalErrorHandler(e);
}
}
else {
await doExport();
const result = await internal._export(this._exporter, resourceMetrics);
if (result.code !== ExportResultCode.SUCCESS) {
throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${result.error})`);
}

@@ -85,0 +84,0 @@ }

@@ -14,2 +14,7 @@ import { MeterProvider as IMeterProvider, Meter as IMeter, MeterOptions } from '@opentelemetry/api';

readers?: MetricReader[];
/**
* Merge resource with {@link Resource.default()}?
* Default: {@code true}
*/
mergeResourceWithDefaults?: boolean;
}

@@ -16,0 +21,0 @@ /**

@@ -21,2 +21,13 @@ /*

/**
* @param mergeWithDefaults
* @param providedResource
*/
function prepareResource(mergeWithDefaults, providedResource) {
const resource = providedResource !== null && providedResource !== void 0 ? providedResource : Resource.empty();
if (mergeWithDefaults) {
return Resource.default().merge(resource);
}
return resource;
}
/**
* This class implements the {@link MeterProvider} interface.

@@ -28,4 +39,3 @@ */

this._shutdown = false;
const resource = Resource.default().merge((_a = options === null || options === void 0 ? void 0 : options.resource) !== null && _a !== void 0 ? _a : Resource.empty());
this._sharedState = new MeterProviderSharedState(resource);
this._sharedState = new MeterProviderSharedState(prepareResource((_a = options === null || options === void 0 ? void 0 : options.mergeResourceWithDefaults) !== null && _a !== void 0 ? _a : true, options === null || options === void 0 ? void 0 : options.resource));
if ((options === null || options === void 0 ? void 0 : options.views) != null && options.views.length > 0) {

@@ -32,0 +42,0 @@ for (const view of options.views) {

@@ -1,2 +0,2 @@

export declare const VERSION = "1.27.0";
export declare const VERSION = "1.28.0";
//# sourceMappingURL=version.d.ts.map

@@ -17,3 +17,3 @@ /*

// this is autogenerated file, see scripts/version-update.js
export const VERSION = '1.27.0';
export const VERSION = '1.28.0';
//# sourceMappingURL=version.js.map

@@ -23,3 +23,2 @@ "use strict";

const utils_1 = require("../utils");
const api_1 = require("@opentelemetry/api");
/**

@@ -74,14 +73,14 @@ * {@link MetricReader} which collects metrics based on a user-configurable time interval, and passes the metrics to

}
const doExport = async () => {
const result = await core_1.internal._export(this._exporter, resourceMetrics);
if (result.code !== core_1.ExportResultCode.SUCCESS) {
throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${result.error})`);
if (resourceMetrics.resource.asyncAttributesPending) {
try {
await ((_b = (_a = resourceMetrics.resource).waitForAsyncAttributes) === null || _b === void 0 ? void 0 : _b.call(_a));
}
};
// Avoid scheduling a promise to make the behavior more predictable and easier to test
if (resourceMetrics.resource.asyncAttributesPending) {
(_b = (_a = resourceMetrics.resource).waitForAsyncAttributes) === null || _b === void 0 ? void 0 : _b.call(_a).then(doExport, err => api_1.diag.debug('Error while resolving async portion of resource: ', err)).catch(core_1.globalErrorHandler);
catch (e) {
api.diag.debug('Error while resolving async portion of resource: ', e);
(0, core_1.globalErrorHandler)(e);
}
}
else {
await doExport();
const result = await core_1.internal._export(this._exporter, resourceMetrics);
if (result.code !== core_1.ExportResultCode.SUCCESS) {
throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${result.error})`);
}

@@ -88,0 +87,0 @@ }

@@ -14,2 +14,7 @@ import { MeterProvider as IMeterProvider, Meter as IMeter, MeterOptions } from '@opentelemetry/api';

readers?: MetricReader[];
/**
* Merge resource with {@link Resource.default()}?
* Default: {@code true}
*/
mergeResourceWithDefaults?: boolean;
}

@@ -16,0 +21,0 @@ /**

@@ -24,2 +24,13 @@ "use strict";

/**
* @param mergeWithDefaults
* @param providedResource
*/
function prepareResource(mergeWithDefaults, providedResource) {
const resource = providedResource !== null && providedResource !== void 0 ? providedResource : resources_1.Resource.empty();
if (mergeWithDefaults) {
return resources_1.Resource.default().merge(resource);
}
return resource;
}
/**
* This class implements the {@link MeterProvider} interface.

@@ -31,4 +42,3 @@ */

this._shutdown = false;
const resource = resources_1.Resource.default().merge((_a = options === null || options === void 0 ? void 0 : options.resource) !== null && _a !== void 0 ? _a : resources_1.Resource.empty());
this._sharedState = new MeterProviderSharedState_1.MeterProviderSharedState(resource);
this._sharedState = new MeterProviderSharedState_1.MeterProviderSharedState(prepareResource((_a = options === null || options === void 0 ? void 0 : options.mergeResourceWithDefaults) !== null && _a !== void 0 ? _a : true, options === null || options === void 0 ? void 0 : options.resource));
if ((options === null || options === void 0 ? void 0 : options.views) != null && options.views.length > 0) {

@@ -35,0 +45,0 @@ for (const view of options.views) {

@@ -1,2 +0,2 @@

export declare const VERSION = "1.27.0";
export declare const VERSION = "1.28.0";
//# sourceMappingURL=version.d.ts.map

@@ -20,3 +20,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '1.27.0';
exports.VERSION = '1.28.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/sdk-metrics",
"version": "1.27.0",
"version": "1.28.0",
"description": "OpenTelemetry metrics SDK",

@@ -57,6 +57,6 @@ "main": "build/src/index.js",

"devDependencies": {
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@opentelemetry/api": ">=1.3.0 <1.10.0",
"@types/mocha": "10.0.8",
"@types/mocha": "10.0.9",
"@types/node": "18.6.5",

@@ -73,3 +73,3 @@ "@types/sinon": "17.0.3",

"lerna": "6.6.2",
"mocha": "10.7.3",
"mocha": "10.8.2",
"nyc": "15.1.0",

@@ -79,3 +79,3 @@ "sinon": "15.1.2",

"typescript": "4.4.4",
"webpack": "5.94.0",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",

@@ -88,8 +88,8 @@ "webpack-merge": "5.10.0"

"dependencies": {
"@opentelemetry/core": "1.27.0",
"@opentelemetry/resources": "1.27.0"
"@opentelemetry/core": "1.28.0",
"@opentelemetry/resources": "1.28.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/sdk-metrics",
"sideEffects": false,
"gitHead": "eb3ca4fb07ee31c62093f5fcec56575573c902ce"
"gitHead": "4b1ad3fda0cde58907e30fab25c3c767546708e5"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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