tracing fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "catalogue",
|
||||
"name": "cart",
|
||||
"version": "1.0.0",
|
||||
"description": "product catalogue REST API",
|
||||
"description": "cart REST API",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
@@ -4,11 +4,6 @@ const mongoObjectID = require('mongodb').ObjectID;
|
||||
const bodyParser = require('body-parser');
|
||||
const express = require('express');
|
||||
|
||||
// MongoDB
|
||||
var db;
|
||||
var collection;
|
||||
var mongoConnected = false;
|
||||
|
||||
// init tracing
|
||||
instana({
|
||||
tracing: {
|
||||
@@ -16,6 +11,10 @@ instana({
|
||||
}
|
||||
});
|
||||
|
||||
// MongoDB
|
||||
var db;
|
||||
var collection;
|
||||
var mongoConnected = false;
|
||||
|
||||
const app = express();
|
||||
|
||||
|
@@ -7,7 +7,8 @@ ENV GOPATH=/opt/gorcv \
|
||||
|
||||
# install external components
|
||||
RUN go get \
|
||||
github.com/streadway/amqp
|
||||
github.com/streadway/amqp \
|
||||
github.com/instana/golang-sensor
|
||||
|
||||
COPY src /opt/gorcv/
|
||||
|
||||
|
@@ -6,6 +6,13 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/streadway/amqp"
|
||||
"github.com/instana/golang-sensor"
|
||||
ot "github.com/opentracing/opentracing-go"
|
||||
// ext "github.com/opentracing/opentracing-go/ext"
|
||||
)
|
||||
|
||||
const (
|
||||
Service = "Dispatch"
|
||||
)
|
||||
|
||||
var amqpUri string = "amqp://guest:guest@rabbitmq:5672/"
|
||||
@@ -72,6 +79,11 @@ func failOnError(err error, msg string) {
|
||||
|
||||
|
||||
func main() {
|
||||
// Instana tracing
|
||||
ot.InitGlobalTracer(instana.NewTracerWithOptions(&instana.Options{
|
||||
Service: Service,
|
||||
LogLevel: instana.Info}))
|
||||
|
||||
// MQ error channel
|
||||
rabbitCloseError = make(chan *amqp.Error)
|
||||
|
||||
@@ -89,7 +101,7 @@ func main() {
|
||||
log.Printf("Rabbit MQ ready %v\n", ready)
|
||||
|
||||
// subscribe to bound queue
|
||||
msgs, err := rabbitChan.Consume("orders", "", false, false, false, false, nil)
|
||||
msgs, err := rabbitChan.Consume("orders", "", true, false, false, false, nil)
|
||||
failOnError(err, "Failed to consume")
|
||||
|
||||
for d := range msgs {
|
||||
|
@@ -15,9 +15,10 @@ services:
|
||||
networks:
|
||||
- robot-shop
|
||||
rabbitmq:
|
||||
image: rabbitmq:3.7-alpine
|
||||
image: rabbitmq:3.7-management-alpine
|
||||
ports:
|
||||
- "5672"
|
||||
- "15672"
|
||||
networks:
|
||||
- robot-shop
|
||||
catalogue:
|
||||
|
@@ -46,5 +46,5 @@ if __name__ == "__main__":
|
||||
sh.setLevel(logging.INFO)
|
||||
app.logger.addHandler(sh)
|
||||
app.logger.setLevel(logging.INFO)
|
||||
port = int(os.getenv("PAYMENT_PORT", "8080"))
|
||||
port = int(os.getenv("SHOP_PAYMENT_PORT", "8080"))
|
||||
app.run(host='0.0.0.0', port=port)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "catalogue",
|
||||
"name": "user",
|
||||
"version": "1.0.0",
|
||||
"description": "product catalogue REST API",
|
||||
"description": "user REST API",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
@@ -5,11 +5,6 @@ const redis = require('redis');
|
||||
const bodyParser = require('body-parser');
|
||||
const express = require('express');
|
||||
|
||||
// MongoDB
|
||||
var db;
|
||||
var collection;
|
||||
var mongoConnected = false;
|
||||
|
||||
// init tracing
|
||||
instana({
|
||||
tracing: {
|
||||
@@ -17,6 +12,10 @@ instana({
|
||||
}
|
||||
});
|
||||
|
||||
// MongoDB
|
||||
var db;
|
||||
var collection;
|
||||
var mongoConnected = false;
|
||||
|
||||
const app = express();
|
||||
|
||||
|
Reference in New Issue
Block a user