mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
As per the documentation the `socket` argument to the constructor is an optional Socket type not a string type. Using a string would result in a fatal error.
50 lines
1.8 KiB
TypeScript
50 lines
1.8 KiB
TypeScript
// Type definitions for Datadog's nodejs metrics client node-dogstatsd
|
|
// Project: https://github.com/joybro/node-dogstatsd
|
|
// Definitions by: Chris Bobo <https://github.com/chrisbobo>
|
|
// Michael Mifsud <https://github.com/xzyfer>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
/// <reference types="node" />
|
|
|
|
declare module "node-dogstatsd" {
|
|
import * as dgram from 'dgram';
|
|
|
|
export interface StatsDOptions {
|
|
global_tags?: string[];
|
|
}
|
|
|
|
export interface StatsDClient {
|
|
timing(stat: string, time: number, sample_rate?: number, tags?: string[]): void;
|
|
|
|
increment(stat: string, sample_rate?: number, tags?: string[]): void;
|
|
incrementBy(stat: string, value: number, tags?: string[]): void;
|
|
|
|
decrement(stat: string, sample_rate?: number, tags?: string[]): void;
|
|
decrementBy(stat: string, value: number, tags?: string[]): void;
|
|
|
|
gauge(stat: string, value: number, sample_rate?: number, tags?: string[]): void;
|
|
|
|
histogram(stat: string, time: number, sample_rate?: number, tags?: string[]): void;
|
|
}
|
|
|
|
export class StatsD implements StatsDClient {
|
|
public socket: dgram.Socket
|
|
|
|
constructor(host: string, port?: number, socket?: dgram.Socket, options?: StatsDOptions);
|
|
|
|
timing(stat: string, time: number, sample_rate?: number, tags?: string[]): void;
|
|
|
|
increment(stat: string, sample_rate?: number, tags?: string[]): void;
|
|
incrementBy(stat: string, value: number, tags?: string[]): void;
|
|
|
|
decrement(stat: string, sample_rate?: number, tags?: string[]): void;
|
|
decrementBy(stat: string, value: number, tags?: string[]): void;
|
|
|
|
gauge(stat: string, value: number, sample_rate?: number, tags?: string[]): void;
|
|
|
|
histogram(stat: string, time: number, sample_rate?: number, tags?: string[]): void;
|
|
|
|
close(): void;
|
|
}
|
|
}
|