@shopify/statsd
Advanced tools
Comparing version 0.0.0-snapshot-20221216174116 to 0.0.0-snapshot-20230324134013
@@ -11,5 +11,3 @@ 'use strict'; | ||
constructor(options) { | ||
this.statsd = void 0; | ||
this.logger = console; | ||
this.options = void 0; | ||
@@ -76,5 +74,5 @@ if (isChildOptions(options)) { | ||
increment(stat, tags, options = {}) { | ||
increment(stat, tags, options = {}, value = 1) { | ||
return new Promise(resolve => { | ||
this.statsd.increment(stat, 1, options.sampleRate, this.normalizeTags(tags), this.createCallback(resolve)); | ||
this.statsd.increment(stat, value, options.sampleRate, this.normalizeTags(tags), this.createCallback(resolve)); | ||
}); | ||
@@ -81,0 +79,0 @@ } |
@@ -1,6 +0,7 @@ | ||
import { StatsD, ClientOptions as HotShotClientOptions, ChildClientOptions as HotShotChildOptions } from 'hot-shots'; | ||
import type { ClientOptions as HotShotClientOptions, ChildClientOptions as HotShotChildOptions } from 'hot-shots'; | ||
import { StatsD } from 'hot-shots'; | ||
export interface Logger { | ||
log(message: string): void; | ||
} | ||
declare type Tags = { | ||
type Tags = { | ||
[key: string]: string | number | boolean | null | undefined; | ||
@@ -19,3 +20,3 @@ } | string[]; | ||
} | ||
export declare type Options = ClientOptions | ChildOptions; | ||
export type Options = ClientOptions | ChildOptions; | ||
export declare class StatsDClient { | ||
@@ -29,3 +30,3 @@ protected statsd: StatsD; | ||
gauge(stat: string | string[], value: number, tags?: Tags, options?: MetricOptions): Promise<void>; | ||
increment(stat: string | string[], tags?: Tags, options?: MetricOptions): Promise<void>; | ||
increment(stat: string | string[], tags?: Tags, options?: MetricOptions, value?: number): Promise<void>; | ||
close(): Promise<void>; | ||
@@ -32,0 +33,0 @@ childClient(options?: Omit<ChildOptions, 'client'>): StatsDClient; |
@@ -1,1 +0,1 @@ | ||
module.exports = require("./build/cjs/index.js"); | ||
module.exports = require("./build/cjs/index.js"); |
{ | ||
"name": "@shopify/statsd", | ||
"version": "0.0.0-snapshot-20221216174116", | ||
"version": "0.0.0-snapshot-20230324134013", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "An opinionated StatsD client for Shopify Node.js servers and other StatsD utilities", |
@@ -80,2 +80,13 @@ # `@shopify/statsd` | ||
Increment can also be supplied a value to increment the metric by. | ||
```javascript | ||
statsdClient.increment( | ||
'myCounter', | ||
['navigation', 'complete', 'performance'], // user-defined tags to go with the data, | ||
{}, // additional options | ||
4, // value to increment by | ||
); | ||
``` | ||
#### `close` | ||
@@ -82,0 +93,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17458
115
259