New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@turbasen/stats

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turbasen/stats - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

26

index.js

@@ -6,10 +6,17 @@ 'use strict';

const statsd = new StatsD({
host: process.env.STATSD_HOST || 'localhost',
port: process.env.STATSD_PORT || 8125,
prefix: process.env.STATSD_PREFIX || 'turbasen.',
});
let statsd;
try {
statsd = new StatsD({
host: process.env.STATSD_HOST || 'localhost',
port: process.env.STATSD_PORT || 8125,
prefix: process.env.STATSD_PREFIX || 'turbasen.',
});
} catch (err) {
console.error(err); // eslint-disable-line no-console
}
module.exports = () => (req, res, next) => {
try {
// Log to GA
const ua = universalAnalytics(process.env.GA_ID);

@@ -19,10 +26,15 @@ const requestParams = module.exports.getRequestParams(req);

if (err) {
throw new Error(err);
console.error(err); // eslint-disable-line no-console
}
});
// Log to statsd
statsd.increment('http.request.count');
if (req.user.type === 'token') {
statsd.increment(`http.request.count.${req.user.app}`.toLowerCase());
const appName = req.user.app.replace(/[^a-zA-Z0-9]/g, '');
statsd.increment(`http.request.count.${appName}`.toLowerCase());
} else {
statsd.increment('http.request.count.anonymous');
}

@@ -29,0 +41,0 @@ } catch (err) {

{
"name": "@turbasen/stats",
"version": "1.2.0",
"version": "1.3.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc