Skip to content

Commit 0822410

Browse files
committed
added Dockerfile
1 parent c4d36a1 commit 0822410

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:10.15.3-alpine
2+
USER root
3+
4+
WORKDIR /opt/event-stream-processor
5+
6+
RUN apk --no-cache add git
7+
RUN apk add --no-cache -t build-dependencies make gcc g++ python libtool autoconf automake \
8+
&& cd $(npm root -g)/npm \
9+
&& npm config set unsafe-perm true \
10+
&& npm install -g node-gyp
11+
12+
COPY package.json package-lock.json* /opt/event-stream-processor/
13+
14+
RUN npm install --production && \
15+
npm uninstall -g npm
16+
17+
COPY src /opt/event-stream-processor/src
18+
COPY config /opt/event-stream-processor/config
19+
COPY app.js /opt/event-stream-processor/
20+
# COPY docs /opt/central-event-processor/docs
21+
22+
RUN apk del build-dependencies
23+
24+
EXPOSE 3082
25+
CMD node app.js

config/default.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"timeout": 3.0,
66
"reconnectInterval": 600
77
},
8-
"PORT": 3081,
8+
"PORT": 3082,
99
"KAFKA": {
1010
"TOPIC_TEMPLATES": {
1111
"GENERAL_TOPIC_TEMPLATE": {

src/observables/apmTracerObservable.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ const apmTracerObservable = ({ message }) => {
77
return Rx.Observable.create(observable => {
88
const flags = Buffer.alloc(1).fill(1)
99
const version = Buffer.alloc(1).fill(0)
10-
const { service, traceId, parentSpanId, spanId, timestamp, endTimestamp } = message.value.metadata.trace
10+
const { service, traceId, parentSpanId, spanId, startTimestamp, finishTimestamp } = message.value.metadata.trace
1111
const traceIdBuff = Buffer.from(traceId, 'hex')
1212
const spanIdBuff = Buffer.from(spanId, 'hex')
1313
const parentSpanIdBuff = parentSpanId && Buffer.from(parentSpanId, 'hex')
1414
Logger.info(`version: ${version.toString('hex')} traceId: ${traceId} spanId: ${spanId} parentSpanId: ${parentSpanId} flags: ${flags.toString('hex')}`)
1515
const context = parentSpanIdBuff
1616
? new TraceParent(Buffer.concat([version, traceIdBuff, spanIdBuff, flags, parentSpanIdBuff]))
1717
: new TraceParent(Buffer.concat([version, traceIdBuff, spanIdBuff, flags]))
18-
let span = tracer.startSpan(`${service}`, { startTime: Date.parse(timestamp) }, context)
18+
let span = tracer.startSpan(`${service}`, { startTime: Date.parse(startTimestamp) }, context)
1919
tracer.startSpan()
2020
span.setTag('payload', message.value.content.payload)
2121
span.setTag('messageId', message.value.id)
22-
span.finish(Date.parse(endTimestamp))
22+
span.finish(Date.parse(finishTimestamp))
2323
observable.next({ span })
2424
})
2525
}

0 commit comments

Comments
 (0)