tracing tweaks
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
const instana = require('instana-nodejs-sensor');
|
||||
const mongoClient = require('mongodb').MongoClient;
|
||||
const mongoObjectID = require('mongodb').ObjectID;
|
||||
const redis = require('redis');
|
||||
const bodyParser = require('body-parser');
|
||||
const express = require('express');
|
||||
|
||||
// init tracing
|
||||
// MUST be done before loading anything else!
|
||||
instana({
|
||||
tracing: {
|
||||
enabled: true
|
||||
}
|
||||
});
|
||||
|
||||
const mongoClient = require('mongodb').MongoClient;
|
||||
const mongoObjectID = require('mongodb').ObjectID;
|
||||
const redis = require('redis');
|
||||
const bodyParser = require('body-parser');
|
||||
const express = require('express');
|
||||
|
||||
// MongoDB
|
||||
var db;
|
||||
var collection;
|
||||
@@ -39,11 +40,14 @@ app.get('/health', (req, res) => {
|
||||
// use REDIS INCR to track anonymous users
|
||||
app.get('/uniqueid', (req, res) => {
|
||||
// get number from Redis
|
||||
redisClient.incr('user', (err, r) => {
|
||||
redisClient.incr('anonymous-counter', (err, r) => {
|
||||
if(!err) {
|
||||
res.json({
|
||||
uuid: 'anonymous-' + r
|
||||
});
|
||||
} else {
|
||||
console.log('ERROR', err);
|
||||
res.status(500).send(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user