tracing tweaks

This commit is contained in:
Steve Waterworth
2018-01-31 17:27:17 +00:00
parent e778bd7f5b
commit 3f5034a102
6 changed files with 98 additions and 23 deletions

View File

@@ -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);
}
});
});