/* tslint:disable */ /* eslint-disable */ /** */ export function core_mixer_set_panic_hook(): void; /** * @returns {string} */ export function core_mixer_gather_metrics(): string; /** * A mixer wrapper around the core functionality * * Async closure interaction was inspired by: https://www.fpcomplete.com/blog/captures-closures-async/ * @param {AsyncIterator} packet_input * @returns {AsyncIterableHelperMixer} */ export function new_mixer(packet_input: AsyncIterator): AsyncIterableHelperMixer; /** * A naive merging method for two serialized metric registries. * It performs union of the sets, removing those metrics which have the same name and type. * @param {string} metrics1 * @param {string} metrics2 * @returns {string} */ export function merge_encoded_metrics(metrics1: string, metrics2: string): string; /** */ export function utils_metrics_set_panic_hook(): void; /** * @returns {string} */ export function gather_all_metrics(): string; /** * @param {string} name * @param {string} description * @returns {SimpleCounter} */ export function create_counter(name: string, description: string): SimpleCounter; /** * @param {string} name * @param {string} description * @param {(string)[]} labels * @returns {MultiCounter} */ export function create_multi_counter(name: string, description: string, labels: (string)[]): MultiCounter; /** * @param {string} name * @param {string} description * @returns {SimpleGauge} */ export function create_gauge(name: string, description: string): SimpleGauge; /** * @param {string} name * @param {string} description * @param {(string)[]} labels * @returns {MultiGauge} */ export function create_multi_gauge(name: string, description: string, labels: (string)[]): MultiGauge; /** * @param {string} name * @param {string} description * @returns {SimpleHistogram} */ export function create_histogram(name: string, description: string): SimpleHistogram; /** * @param {string} name * @param {string} description * @param {Float64Array} buckets * @returns {SimpleHistogram} */ export function create_histogram_with_buckets(name: string, description: string, buckets: Float64Array): SimpleHistogram; /** * @param {string} name * @param {string} description * @param {(string)[]} labels * @returns {MultiHistogram} */ export function create_multi_histogram(name: string, description: string, labels: (string)[]): MultiHistogram; /** * @param {string} name * @param {string} description * @param {Float64Array} buckets * @param {(string)[]} labels * @returns {MultiHistogram} */ export function create_multi_histogram_with_buckets(name: string, description: string, buckets: Float64Array, labels: (string)[]): MultiHistogram; /** */ export function utils_misc_set_panic_hook(): void; /** * Dummy function to test WASM. * @returns {string} */ export function dummy_get_one(): string; /** * Reads the given package.json file and determines its version. * @param {string} package_file * @returns {string} */ export function get_package_version(package_file: string): string; /** */ export function utils_log_set_panic_hook(): void; /** * Helper struct to export Rust Streams into Javascript AsyncIterables * * ``` * use futures::stream::{Stream, StreamExt}; * use wasm_bindgen::prelude::*; * use wasm_bindgen_futures::stream::JsStream; * use js_sys::AsyncIterator; * use utils_misc::async_iterable::wasm::to_box_u8_stream; * * #[wasm_bindgen] * pub struct AsyncIterableHelper { * stream: Box, String>> + Unpin>, // must not be pub * } * #[wasm_bindgen] * pub fn async_test(some_async_iterable: AsyncIterator) -> Result { * let stream = JsStream::from(some_async_iterable); * * let stream = stream.map(to_box_u8_stream); * * Ok(AsyncIterableHelper { * stream: Box::new(stream), * }) * } * ``` */ export class AsyncIterableHelper { free(): void; /** * @returns {Promise} */ next(): Promise; } /** */ export class AsyncIterableHelperMixer { free(): void; /** * @returns {Promise} */ next(): Promise; } /** */ export class IteratorResult { free(): void; } /** */ export class MixerConfig { free(): void; /** * Create an instance of a new mixer configuration * * # Arguments * * `min_delay` - the minimum delay invoked by the mixer represented in milliseconds * * `min_delay` - the maximum delay invoked by the mixer represented in milliseconds * @param {bigint} min_delay * @param {bigint} max_delay * @returns {MixerConfig} */ static new(min_delay: bigint, max_delay: bigint): MixerConfig; /** */ metric_delay_window: bigint; } /** * Represents a vector of named monotonic unsigned integer counters. * Wrapper for IntCounterVec type */ export class MultiCounter { free(): void; /** * Returns the name of the counter vector given at construction. * @returns {string} */ name(): string; /** * @param {(string)[]} label_values * @param {bigint} by */ increment_by(label_values: (string)[], by: bigint): void; /** * @param {(string)[]} label_values */ increment(label_values: (string)[]): void; /** * @param {(string)[]} label_values * @returns {bigint} */ get(label_values: (string)[]): bigint; } /** * Represents a vector of gauges with floating point values. * Wrapper for GaugeVec type */ export class MultiGauge { free(): void; /** * Returns the name of the gauge vector given at construction. * @returns {string} */ name(): string; /** * @param {(string)[]} label_values * @param {number} by */ increment_by(label_values: (string)[], by: number): void; /** * @param {(string)[]} label_values */ increment(label_values: (string)[]): void; /** * @param {(string)[]} label_values * @param {number} by */ decrement_by(label_values: (string)[], by: number): void; /** * @param {(string)[]} label_values */ decrement(label_values: (string)[]): void; /** * @param {(string)[]} label_values * @param {number} value */ set(label_values: (string)[], value: number): void; /** * @param {(string)[]} label_values * @returns {number} */ get(label_values: (string)[]): number; } /** * Represents a vector of histograms with floating point values. * Wrapper for HistogramVec type */ export class MultiHistogram { free(): void; /** * Stops the given timer and records the elapsed duration in seconds to the multi-histogram. * @param {SimpleTimer} timer */ record_measure(timer: SimpleTimer): void; /** * Stops the given timer and discards the measured duration in seconds and returns it. * @param {SimpleTimer} timer * @returns {number} */ cancel_measure(timer: SimpleTimer): number; /** * Returns the name of the histogram given at construction. * @returns {string} */ name(): string; /** * @param {(string)[]} label_values * @param {number} value */ observe(label_values: (string)[], value: number): void; /** * @param {(string)[]} label_values * @returns {SimpleTimer} */ start_measure(label_values: (string)[]): SimpleTimer; /** * @param {(string)[]} label_values * @returns {bigint} */ get_sample_count(label_values: (string)[]): bigint; /** * @param {(string)[]} label_values * @returns {number} */ get_sample_sum(label_values: (string)[]): number; } /** * Represents a simple monotonic unsigned integer counter. * Wrapper for IntCounter type */ export class SimpleCounter { free(): void; /** * Retrieves the value of the counter * @returns {bigint} */ get(): bigint; /** * Increments the counter by the given number. * @param {bigint} by */ increment_by(by: bigint): void; /** * Increments the counter by 1 */ increment(): void; /** * Returns the name of the counter given at construction. * @returns {string} */ name(): string; } /** * Represents a simple gauge with floating point values. * Wrapper for Gauge type */ export class SimpleGauge { free(): void; /** * Increments the gauge by the given value. * @param {number} by */ increment(by: number): void; /** * Decrements the gauge by the given value. * @param {number} by */ decrement(by: number): void; /** * Sets the gauge to the given value. * @param {number} value */ set(value: number): void; /** * Retrieves the value of the gauge * @returns {number} */ get(): number; /** * Returns the name of the gauge given at construction. * @returns {string} */ name(): string; } /** * Represents a histogram with floating point values. * Wrapper for Histogram type */ export class SimpleHistogram { free(): void; /** * Records a value observation to the histogram. * @param {number} value */ observe(value: number): void; /** * Stops the given timer and records the elapsed duration in seconds to the histogram. * @param {SimpleTimer} timer */ record_measure(timer: SimpleTimer): void; /** * Stops the given timer and discards the measured duration in seconds and returns it. * @param {SimpleTimer} timer * @returns {number} */ cancel_measure(timer: SimpleTimer): number; /** * Get all samples count * @returns {bigint} */ get_sample_count(): bigint; /** * Get all samples sum * @returns {number} */ get_sample_sum(): number; /** * Returns the name of the histogram given at construction. * @returns {string} */ name(): string; /** * @returns {SimpleTimer} */ start_measure(): SimpleTimer; } /** * Represents a timer handle. */ export class SimpleTimer { free(): void; }