
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
statful-client-javascript
Advanced tools
Staful client for Javascript. This client is intended to gather metrics and send them to Statful.
It supports every browser that has full support for the ECMAScript 5 specification.
bower install --save statful-client-javascript
or
npm install --save statful-client-javascript
After installing Statful Client you are ready to use it. The quickest way is to do the following:
<script type="text/javascript" src="bower_components/statful-client-javascript/dist/statful.min.js"></script>
<script>
// Init statful
statful.initialize({
dryrun: false,
debug: false,
app: 'exampleApp',
flushInterval: 5000
});
// Send a metric
statful.counter('page_load');
</script>
Detailed reference if you want to take full advantage from Statful.
The custom options that can be set on config param are detailed below.
Option | Description | Type | Default | Required |
---|---|---|---|---|
dryRun | Defines if metrics should be output to the logger instead of being send. | boolean | false | NO |
debug | Defines logs should be sent to console. | boolean | false | NO |
app | Defines the application global name. If specified sets a global tag app=setValue . | string | undefined | NO |
namespace | Defines the global namespace. | string | web | NO |
sampleRate | Defines the rate sampling. Should be a number between [1, 100]. | number | 100 | NO |
flushInterval | Defines the periodicity of buffer flushes in miliseconds. | number | 10000 | NO |
timeout | Defines the timeout. | number | 2000 | NO |
tags | Defines the global tags. | object | {} | NO |
aggregations | Defines the global aggregations. | object | [] | NO |
aggregationFrequency | Defines the global aggregation frequency. | number | 10 | NO |
- staful.counter('myCounter', 1, {agg: ['sum']});
- staful.gauge('myGauge', 10, { tags: { host: 'localhost' } });
- staful.timer('myCounter', 200, {namespace: 'sandbox'});
These methods receive a metric name and a metric value as arguments and send a counter/gauge/timer metric. If the options parameter is omitted, the default values are used. Read the methods options reference bellow to get more information about the default values.
Option | Description | Type | Default for Counter | Default for Gauge | Default for Timer |
---|---|---|---|---|---|
agg | Defines the aggregations to be executed. These aggregations are merged with the ones configured globally, including method defaults. Valid Aggregations: avg, count, sum, first, last, p90, p95, min, max | array | ['avg', 'p90'] | [last] | ['avg', 'p90', 'count'] |
aggFreq | Defines the aggregation frequency in seconds. It overrides the global aggregation frequency configuration. Valid Aggregation Frequencies: 10, 30, 60, 120, 180, 300 | number | 10 | 10 | 10 |
sampleRate | Defines the rate sampling. It overrides the global namespace configuration. | number | 100 | 100 | 100 |
namespace | Defines the namespace of the metric. It overrides the global namespace configuration. | string | web | web | web |
tags | Defines the tags of the metric. These tags are merged with the ones configured globally, including method defaults. | object | {} | {} | { unit: 'ms' } |
Support for the user-timing specification is available.
statful.registerMark('mark_start');
statful.registerMark('mark_end');
// Measure and Timer between two marks
statful.registerMark('mark_start');
statful.registerMark('mark_end');
var options = {
startMark: 'mark_start',
endMark: 'mark_end'
tags: {mark: my_tag}
}
statful.registerMeasure('measure_name', 'metric_name' options);
// Measure and Timer from the navigationStart eent until the current time
var options = {
tags: {mark: my_tag}
}
statful.registerMeasure('measure_name', 'metric_name' options);
You can omit both start and end mark names:
$ npm install && bower install
$ grunt test
Follow the standard Fork and Pull Request workflow and:
Statful Javascript Client is available under the MIT license. See the LICENSE file for more information.
FAQs
Statful client for Javascript applications
The npm package statful-client-javascript receives a total of 5 weekly downloads. As such, statful-client-javascript popularity was classified as not popular.
We found that statful-client-javascript demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.