Type for Signalfx package (#38638)

* added signalfx

* fixed test errors

* fixed test errors
This commit is contained in:
Max Boguslavsky
2019-09-26 16:19:50 -07:00
committed by Ben Lichtman
parent 8d3e4aacc9
commit 13e90c82cf
4 changed files with 84 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
// Type definitions for signalfx 7.0
// Project: https://github.com/signalfx/signalfx-nodejs
// Definitions by: Vladimir Grenaderov <https://github.com/VladimirGrenaderov>
// Max Boguslavskiy <https://github.com/maxbogus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export interface IngestOptions {
enableAmazonUniqueId?: boolean;
dimensions?: object;
ingestEndpoint?: string;
timeout?: number;
batchSize?: number;
userAgents?: string[];
proxy?: string;
}
export interface SignalMetric {
metric: string;
value: number;
timestamp?: number;
}
export interface SignalReport {
cumulative_counters?: SignalMetric[];
gauges?: SignalMetric[];
counters?: SignalMetric[];
}
export interface SignalClient {
send(report: SignalReport): void;
}
export class Ingest {
constructor(token: string, options?: IngestOptions);
send(report: SignalReport): void;
}
export class IngestJson {
constructor(token: string, options?: IngestOptions);
send(report: SignalReport): void;
}
export const CONSTANTS: {
MESSAGE_TYPES: {
CONTROL: string;
DATA: string;
EVENT: string;
METADATA: string;
};
};
export function SignalFlow(apiToken: any, options: any): any;
+4
View File
@@ -0,0 +1,4 @@
import * as signalfx from 'signalfx';
const sgnlfx = new signalfx.Ingest('1');
sgnlfx.send({});
+24
View File
@@ -0,0 +1,24 @@
{
"files": [
"index.d.ts",
"signalfx-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}