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