Created
October 9, 2019 18:15
-
-
Save kjin/61bdac2f5cd1c6ef1a13efb2765a69a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tracer = require('@google-cloud/trace-agent').start(); | |
const express = require('express'); | |
const app = express(); | |
// Middleware that just adds a label to each trace. | |
app.use((req, res, next) => { | |
tracer.getCurrentRootSpan().addLabel('key', 'value'); | |
next(); | |
}); | |
app.get('/', async (req, res) => { | |
res.send('hello world!'); | |
}); | |
app.listen(process.env.PORT || 8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment