"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.SuccessRateCounter = void 0; var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ class SuccessRateCounter { constructor() { (0, _defineProperty2.default)(this, "success", 0); (0, _defineProperty2.default)(this, "total", 0); } initialMetric() { return { success: 0, total: 0 }; } get() { return { success: this.success, total: this.total }; } increment(success) { if (success) { this.success++; } this.total++; } reset() { this.success = 0; this.total = 0; } } exports.SuccessRateCounter = SuccessRateCounter;