Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👀 [Frontend] 282 adding initial instrumentation setup #293

Merged
merged 16 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4317
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT}

OTEL_EXPORTER_OTLP_TRACES_PUBLIC_ENDPOINT=http://localhost:4318/v1/traces
xoscar marked this conversation as resolved.
Show resolved Hide resolved

# Load Generator
USERS=10

Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
- ./src/otelcollector/otelcol-config-extras.yml:/etc/otelcol-config-extras.yml
ports:
- "4317" # OTLP over gRPC receiver
- "4318" # OTLP over HTTP receiver
- "4318:4318" # OTLP over HTTP receiver
xoscar marked this conversation as resolved.
Show resolved Hide resolved
xoscar marked this conversation as resolved.
Show resolved Hide resolved
- "9464" # Prometheus exporter
- "8888" # metrics endpoint
depends_on:
Expand Down Expand Up @@ -168,6 +168,7 @@ services:
- RECOMMENDATION_SERVICE_ADDR
- SHIPPING_SERVICE_ADDR
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_EXPORTER_OTLP_TRACES_PUBLIC_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES=service.name=frontend
- OTEL_EXPORTER_OTLP_ENDPOINT
- ENV_PLATFORM
Expand Down
1 change: 1 addition & 0 deletions src/frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 4 additions & 2 deletions src/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ RUN npm ci
FROM node:16-alpine AS builder
RUN apk add --no-cache libc6-compat protoc
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY ./pb ./pb
COPY ./src/frontend .
COPY --from=deps /app/node_modules ./node_modules
xoscar marked this conversation as resolved.
Show resolved Hide resolved

RUN npm run grpc:generate
RUN npm run build
Expand All @@ -26,8 +26,10 @@ RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/utils/telemetry/Instrumentation.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=deps /app/node_modules ./node_modules

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
Expand All @@ -37,4 +39,4 @@ USER nextjs
ENV PORT 8080
EXPOSE ${PORT}

CMD ["node", "server.js"]
CMD ["sh", "-c", "npm start"]
xoscar marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions src/frontend/components/Header/Header.styled.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Link from 'next/link';
import styled from 'styled-components';

export const Header = styled.header`
background-color: #853b5c;
color: white;
`;


export const NavBar = styled.nav`
height: 80px;
background-color: white;
Expand All @@ -14,7 +14,7 @@ export const NavBar = styled.nav`
border-bottom: 1px solid ${({ theme }) => theme.colors.textGray};
z-index: 1;
padding: 0;

${({ theme }) => theme.breakpoints.desktop} {
height: 100px;
}
Expand All @@ -33,7 +33,7 @@ export const Container = styled.div`
}
`;

export const NavBarBrand = styled.a`
export const NavBarBrand = styled(Link)`
display: flex;
align-items: center;
padding: 0;
Expand Down
7 changes: 7 additions & 0 deletions src/frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const {
RECOMMENDATION_SERVICE_ADDR = '',
SHIPPING_SERVICE_ADDR = '',
ENV_PLATFORM = '',
OTEL_EXPORTER_OTLP_TRACES_PUBLIC_ENDPOINT = '',
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = '',
OTEL_SERVICE_NAME = 'frontend',
} = process.env;

const nextConfig = {
Expand All @@ -34,6 +37,7 @@ const nextConfig = {
config.resolve.fallback.net = false;
config.resolve.fallback.dns = false;
config.resolve.fallback.fs = false;
config.resolve.fallback.async_hooks = false;
}
return config;
},
Expand All @@ -45,7 +49,10 @@ const nextConfig = {
PRODUCT_CATALOG_SERVICE_ADDR,
RECOMMENDATION_SERVICE_ADDR,
SHIPPING_SERVICE_ADDR,
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT,
xoscar marked this conversation as resolved.
Show resolved Hide resolved
NEXT_PUBLIC_OTEL_EXPORTER_OTLP_TRACES_PUBLIC_ENDPOINT: OTEL_EXPORTER_OTLP_TRACES_PUBLIC_ENDPOINT,
NEXT_PUBLIC_PLATFORM: ENV_PLATFORM,
NEXT_PUBLIC_OTEL_SERVICE_NAME: OTEL_SERVICE_NAME,
},
};

Expand Down
Loading