"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MetricClient = void 0;
exports.unsafeInstallListener = unsafeInstallListener;
exports.unsafeRemoveListener = unsafeRemoveListener;
exports.unsafeSnapshot = unsafeSnapshot;

var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/core/io/Metrics/operations/registry"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * A `MetricClient` provides the functionality to consume metrics produced by
 * Effect applications. `MetricClient` supports two ways of consuming metrics,
 * corresponding to the two ways that third party metrics services use metrics.
 *
 * First, metrics services can poll for the current state of all recorded
 * metrics using the `unsafeSnapshot` method, which provides a snapshot, as of a
 * point in time, of all metrics recorded by the Effect application.
 *
 * Second, metrics services can install a listener that will be notified every
 * time a metric is updated.
 *
 * `MetricClient` is a lower level interface and is intended to be used by
 * implementers of integrations with third party metrics services but not by end
 * users.
 */
const MetricClient = {};
/**
 * Unsafely installs the specified metric listener.
 *
 * @tsplus static ets/Metrics/MetricClient/Ops unsafeInstallListener
 */

exports.MetricClient = MetricClient;

function unsafeInstallListener(listener) {
  tsplus_module_1.metricRegistry.value.installListener(listener);
}
/**
 * Unsafely removes the specified metric listener.
 *
 * @tsplus static ets/Metrics/MetricClient/Ops unsafeInstallListener
 */


function unsafeRemoveListener(listener) {
  tsplus_module_1.metricRegistry.value.removeListener(listener);
}
/**
 * Unsafely captures a snapshot of all metrics recorded by the application.
 *
 * @tsplus static ets/Metrics/MetricClient/Ops unsafeSnapshot
 */


function unsafeSnapshot() {
  return tsplus_module_1.metricRegistry.value.snapshot();
}
//# sourceMappingURL=MetricClient.js.map