From 66cfec20e9000ba64e63a7166af056987e4a6467 Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Wed, 7 Jun 2023 17:53:26 +0200 Subject: [PATCH 1/2] Add Dockerfile --- .dockerignore | 16 +++++++ Dockerfile | 23 ++++++++++ nginx.conf.template | 13 ++++++ .../TraceTimelineViewer/SpanDetail/index.tsx | 42 +++++++++++-------- 4 files changed, 76 insertions(+), 18 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 nginx.conf.template diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..cdfb0c8c00 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,16 @@ +*.md +**/node_modules + +.git +.github +media +.gitignore +.nvmrc +DCO +LICENSE + +packages/jaeger-ui/build +packages/jaeger-ui/stats.html +packages/plexus/dist +packages/plexus/lib +packages/plexus/libtsconfig.tsbuildinfo diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..b5ce74e1e3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM node:16.20.0 AS build + +WORKDIR /app + +COPY package.json ./ +COPY yarn.lock ./ +COPY packages/jaeger-ui/package.json ./packages/jaeger-ui/ +COPY . . +RUN yarn install --frozen-lockfile +# RUN yarn prettier-lint +# RUN yarn eslint + +WORKDIR /app/packages/jaeger-ui + +# RUN yarn test +RUN yarn build + +FROM nginx:1.25.0 + +COPY --from=build /app/packages/jaeger-ui/build/ /usr/share/nginx/html/ +COPY ./nginx.conf.template /etc/nginx/conf.d/default.conf.template + +CMD ["/bin/sh" , "-c" , "envsubst '${JAEGER_QUERY_URL}' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"] \ No newline at end of file diff --git a/nginx.conf.template b/nginx.conf.template new file mode 100644 index 0000000000..21edbfd6ca --- /dev/null +++ b/nginx.conf.template @@ -0,0 +1,13 @@ +server { + listen 80; + root /usr/share/nginx/html; + + location / { + index index.html; + try_files $uri /index.html; + } + + location /api { + proxy_pass ${JAEGER_QUERY_URL}/api; + } +} \ No newline at end of file diff --git a/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx b/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx index 33f9b14c2c..bd6f7193c7 100644 --- a/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx +++ b/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx @@ -63,7 +63,7 @@ export default class SpanDetail extends React.Component tag.key === 'otel.library.name'); - const functionTag = tags.find((tag: any) => tag.key === 'code.function'); - const namespaceTag = tags.find((tag: any) => tag.key === 'code.namespace'); - const spanCodeObjectIdTag = tags.find((tag: any) => tag.key === 'digma.span.code.object.id'); - const methodCodeObjectIdTag = tags.find((tag: any) => tag.key === 'digma.method.code.object.id'); + _prepareSpanInfo() { + const tagsToGet = { + instrumentationLibrary: 'otel.library.name', + function: 'code.function', + namespace: 'code.namespace', + spanCodeObjectIdTag: 'digma.span.code.object.id', + methodCodeObjectId: 'digma.method.code.object.id', + }; + + const tagsValues = Object.entries(tagsToGet).reduce((acc, [key, value]) => { + const tag = this.props.span.tags.find((x: any) => x.key === value); + return tag ? { ...acc, [key]: [tag.value] } : acc; + }, {}); return { + ...tagsValues, id: this.props.span.spanID, name: this.props.span.operationName, - ...(otelLibraryNameTag ? { instrumentationLibrary: otelLibraryNameTag.value } : {}), - ...(functionTag ? { function: functionTag.value } : {}), - ...(namespaceTag ? { namespace: namespaceTag.value } : {}), - ...(spanCodeObjectIdTag ? { spanCodeObjectId: spanCodeObjectIdTag.value } : {}), - ...(methodCodeObjectIdTag ? { methodCodeObjectId: methodCodeObjectIdTag.value } : {}), }; } _handleCodeButtonClick() { - const spanTags = this._getSpanTags(this.props.span.tags); + const spanInfo = this._prepareSpanInfo(); window.sendMessageToDigma({ action: actions.GO_TO_SPAN, - payload: spanTags, + payload: spanInfo, }); } _handleSpanNameLinkClick() { - const spanTags = this._getSpanTags(this.props.span.tags); + const spanInfo = this._prepareSpanInfo(); window.sendMessageToDigma({ action: actions.GO_TO_INSIGHTS, - payload: spanTags, + payload: spanInfo, }); } @@ -167,13 +170,16 @@ export default class SpanDetail extends React.Component
- {otelLibraryNameTag && this.state.insights.length > 0 ? ( + {isInstrumentationLibraryPresent && this.state.insights.length > 0 ? ( Date: Wed, 7 Jun 2023 18:12:49 +0200 Subject: [PATCH 2/2] Fix getting the tag value --- .../TracePage/TraceTimelineViewer/SpanDetail/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx b/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx index bd6f7193c7..9a6b53059c 100644 --- a/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx +++ b/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx @@ -107,7 +107,7 @@ export default class SpanDetail extends React.Component { const tag = this.props.span.tags.find((x: any) => x.key === value); - return tag ? { ...acc, [key]: [tag.value] } : acc; + return tag ? { ...acc, [key]: tag.value } : acc; }, {}); return {