@dash0/sdk-web
Version:
Dash0's Web SDK to collect telemetry from end-users' web browsers
31 lines (30 loc) • 1.35 kB
TypeScript
import { AnyValue, KeyValue } from "../../types/otlp";
type PrimitiveAttributeValue = string | number | boolean;
export type AttributeValueType = PrimitiveAttributeValue | Array<PrimitiveAttributeValue> | Record<string, PrimitiveAttributeValue>;
export declare function toAnyValue(value: AttributeValueType | AnyValue): AnyValue;
export declare function toAnyValue(value?: AttributeValueType | AnyValue): AnyValue | undefined;
export declare function toKeyValue(key: string, value: AttributeValueType | AnyValue): KeyValue;
/**
* Adds a single attribute to the provided attributes array
*/
export declare function addAttribute(attributes: KeyValue[], key: string, value: AttributeValueType | AnyValue): void;
/**
* Adds multiple attributes to the provided attributes array
*/
export declare function addAttributes(
/**
* The attributes array to add to
*/
attributes: KeyValue[],
/**
* Additional attributes to add
* If no attributes are provided, nothing is added
*/
attrs: Record<string, AttributeValueType | AnyValue> | undefined): void;
/**
* Removes an attribute from the provided attributes array by its key
*/
export declare function removeAttribute(attributes: KeyValue[], key: string): void;
export type AttrPrefix = string | string[];
export declare function withPrefix(prefix?: AttrPrefix): (attr: string) => string;
export {};