-
Notifications
You must be signed in to change notification settings - Fork 0
push initial setup #1
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
2c9c653
9a6ac0a
0a3047a
f719fe2
f9b9fd5
bffab63
802a4db
352d9c8
6827171
37d36df
940eef7
e2db365
f9f7b64
9d2e3b1
54b8ca6
45bb4a7
e4ac2e9
3e53988
f2594f5
6a74e91
e7ce5ac
6929ce7
3505af0
9e725f1
47ea34b
61f4a85
c6001f1
c94ec37
c67547a
3528824
15ed95d
f1e5697
7b57907
2bd3055
e3bbf04
f6b5dc4
3b35709
bf65fa2
d1f0bf5
2f5a492
5a85c23
8fb3a76
55b1c92
a473009
c53d7ef
3c03455
abf1ad3
6d84559
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,94 @@ | ||||||||||||||||||||||||
# HyperDX API and App Server Dockerfile | ||||||||||||||||||||||||
# This Dockerfile creates a single image with both the API and App servers | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
ARG NODE_VERSION=22.16.0 | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Base stage with Node.js and dependencies | ||||||||||||||||||||||||
FROM node:${NODE_VERSION}-alpine AS base | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
WORKDIR /app | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Copy workspace configuration files | ||||||||||||||||||||||||
COPY .yarn ./.yarn | ||||||||||||||||||||||||
COPY .yarnrc.yml yarn.lock package.json nx.json .prettierrc .prettierignore ./ | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Copy package.json files for all packages | ||||||||||||||||||||||||
COPY ./packages/common-utils/package.json ./packages/common-utils/ | ||||||||||||||||||||||||
COPY ./packages/api/package.json ./packages/api/ | ||||||||||||||||||||||||
COPY ./packages/app/package.json ./packages/app/ | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Install dependencies | ||||||||||||||||||||||||
RUN apk add --no-cache libc6-compat | ||||||||||||||||||||||||
RUN yarn install --mode=skip-build && yarn cache clean | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Builder stage | ||||||||||||||||||||||||
FROM base AS builder | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
WORKDIR /app | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Copy source code for all packages | ||||||||||||||||||||||||
COPY ./packages/common-utils ./packages/common-utils | ||||||||||||||||||||||||
COPY ./packages/api ./packages/api | ||||||||||||||||||||||||
COPY ./packages/app ./packages/app | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Set build environment variables | ||||||||||||||||||||||||
ENV NEXT_TELEMETRY_DISABLED 1 | ||||||||||||||||||||||||
ENV NEXT_PUBLIC_IS_LOCAL_MODE false | ||||||||||||||||||||||||
ENV NX_DAEMON=false | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Build packages in dependency order | ||||||||||||||||||||||||
RUN yarn workspace @hyperdx/common-utils build | ||||||||||||||||||||||||
RUN yarn workspace @hyperdx/api build | ||||||||||||||||||||||||
RUN yarn workspace @hyperdx/app build | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Production stage | ||||||||||||||||||||||||
FROM node:${NODE_VERSION}-alpine AS production | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
ARG CODE_VERSION=2.1.1 | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
ENV CODE_VERSION=2.1.1 | ||||||||||||||||||||||||
ENV NODE_ENV production | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Install concurrently for running multiple processes | ||||||||||||||||||||||||
RUN npm install -g [email protected] | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Create non-root user | ||||||||||||||||||||||||
RUN addgroup -g 1001 -S nodejs | ||||||||||||||||||||||||
RUN adduser -S nodejs -u 1001 | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
USER nodejs | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
WORKDIR /app | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Copy built API | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/api/dist ./packages/api/dist | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/api/package.json ./packages/api/package.json | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Copy built App (Next.js) | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/app/.next ./packages/app/.next | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/app/public ./packages/app/public | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/app/package.json ./packages/app/package.json | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/app/next.config.js ./packages/app/next.config.js | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Copy built common-utils | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/common-utils/dist ./packages/common-utils/dist | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/common-utils/package.json ./packages/common-utils/package.json | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Copy node_modules for runtime dependencies | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/node_modules ./node_modules | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/api/node_modules ./packages/api/node_modules | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/app/node_modules ./packages/app/node_modules | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs --from=builder /app/packages/common-utils/node_modules ./packages/common-utils/node_modules | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Copy and set up entry script | ||||||||||||||||||||||||
COPY --chown=nodejs:nodejs docker/hyperdx/entry.prod.sh /etc/local/entry.sh | ||||||||||||||||||||||||
RUN chmod +x /etc/local/entry.sh | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Expose ports | ||||||||||||||||||||||||
EXPOSE 8000 8080 | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Health check | ||||||||||||||||||||||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ | ||||||||||||||||||||||||
CMD curl -f http://localhost:8000/health || exit 1 | ||||||||||||||||||||||||
Comment on lines
+91
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure curl is available for health check The HEALTHCHECK uses Add curl installation in the production stage: FROM node:${NODE_VERSION}-alpine AS production
ARG CODE_VERSION=2.1.1
+# Install curl for healthcheck
+RUN apk add --no-cache curl
+
ENV CODE_VERSION=${CODE_VERSION}
ENV NODE_ENV production 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
ENTRYPOINT ["sh", "/etc/local/entry.sh"] |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,87 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pipeline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
agent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kubernetes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
label 'hyperdx' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
apiVersion: v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kind: Pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
spec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
containers: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: dind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image: sc-mum-armory.platform.internal/devops/dind:v2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
securityContext: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
privileged: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: DOCKER_HOST | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value: tcp://localhost:2375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: DOCKER_TLS_CERTDIR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value: "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+10
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Security concern: Privileged container without TLS The dind container runs with Consider enabling TLS for the Docker daemon or document why this security trade-off is acceptable in your environment. 🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
volumeMounts: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: dind-storage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mountPath: /var/lib/docker | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
readinessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tcpSocket: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
port: 2375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
initialDelaySeconds: 30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
periodSeconds: 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
livenessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tcpSocket: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
port: 2375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
initialDelaySeconds: 30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
periodSeconds: 20 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: builder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image: sc-mum-armory.platform.internal/devops/builder-image-armory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
command: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- sleep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- infinity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: DOCKER_HOST | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value: tcp://localhost:2375 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: DOCKER_BUILDKIT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value: "0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
volumeMounts: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: jenkins-sa | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mountPath: /root/.gcp/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+9
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add resource limits for containers The Pod specification lacks resource limits and requests for both containers, which could lead to resource contention and pod instability. Add resource limits to prevent unbounded resource consumption: spec:
containers:
- name: dind
image: sc-mum-armory.platform.internal/devops/dind:v2
+ resources:
+ requests:
+ memory: "512Mi"
+ cpu: "500m"
+ limits:
+ memory: "2Gi"
+ cpu: "2000m"
securityContext:
privileged: true - name: builder
image: sc-mum-armory.platform.internal/devops/builder-image-armory
+ resources:
+ requests:
+ memory: "1Gi"
+ cpu: "1000m"
+ limits:
+ memory: "4Gi"
+ cpu: "4000m"
command:
- sleep 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: dind-storage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
emptyDir: {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- name: jenkins-sa | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
secret: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
secretName: jenkins-sa | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
environment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sc_regions="mumbai" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GITHUB_TOKEN = credentials('github-access') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
app="hyperdx" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
buildarg_DEPLOYMENT_ID="hyperdx-$GIT_COMMIT" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
buildarg_GITHUB_TOKEN="${GITHUB_TOKEN}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stages { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stage('build') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
steps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
container('builder') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sh "armory build" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stage('push') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
when { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
anyOf { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
branch 'main' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
branch 'staging' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
branch 'feature/*' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
steps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
container('builder') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sh "armory push" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -29,6 +29,37 @@ import { mergePath } from '@/utils'; | |||||||||||||||||||||
import resizeStyles from '../../styles/ResizablePanel.module.scss'; | ||||||||||||||||||||||
import classes from '../../styles/SearchPage.module.scss'; | ||||||||||||||||||||||
|
||||||||||||||||||||||
// Override keys for specific source types | ||||||||||||||||||||||
const serviceMapOverride = { | ||||||||||||||||||||||
Logs: [ | ||||||||||||||||||||||
'SeverityText', | ||||||||||||||||||||||
'ServiceName', | ||||||||||||||||||||||
"ResourceAttributes['k8s.cluster.name']", | ||||||||||||||||||||||
"ResourceAttributes['k8s.namespace.name']", | ||||||||||||||||||||||
], | ||||||||||||||||||||||
Traces: [ | ||||||||||||||||||||||
'ServiceName', | ||||||||||||||||||||||
'StatusCode', | ||||||||||||||||||||||
"ResourceAttributes['k8s.node.name']", | ||||||||||||||||||||||
"ResourceAttributes['k8s.owner.name']", | ||||||||||||||||||||||
'SpanKind', | ||||||||||||||||||||||
], | ||||||||||||||||||||||
'K8s Events': [ | ||||||||||||||||||||||
"ResourceAttributes['k8s.cluster.name']", | ||||||||||||||||||||||
"LogAttributes['k8s.namespace.name']", | ||||||||||||||||||||||
"LogAttributes['k8s.event.reason']", | ||||||||||||||||||||||
], | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
|
||||||||||||||||||||||
// Helper function to get keys - override for specific types, use default for others | ||||||||||||||||||||||
const getKeysForSourceType = (sourceType?: string) => { | ||||||||||||||||||||||
if (sourceType && sourceType in serviceMapOverride) { | ||||||||||||||||||||||
return serviceMapOverride[sourceType as keyof typeof serviceMapOverride]; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
// For other source types, return empty array to use default behavior | ||||||||||||||||||||||
return []; | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
|
||||||||||||||||||||||
type FilterCheckboxProps = { | ||||||||||||||||||||||
label: string; | ||||||||||||||||||||||
value?: 'included' | 'excluded' | false; | ||||||||||||||||||||||
|
@@ -166,12 +197,17 @@ export const FilterGroup = ({ | |||||||||||||||||||||
onFieldPinClick, | ||||||||||||||||||||||
isFieldPinned, | ||||||||||||||||||||||
onLoadMore, | ||||||||||||||||||||||
loadMoreLoading, | ||||||||||||||||||||||
hasLoadedMore, | ||||||||||||||||||||||
}: FilterGroupProps) => { | ||||||||||||||||||||||
const [search, setSearch] = useState(''); | ||||||||||||||||||||||
const [isExpanded, setExpanded] = useState(false); | ||||||||||||||||||||||
|
||||||||||||||||||||||
useEffect(() => { | ||||||||||||||||||||||
if (onLoadMore && !hasLoadedMore) { | ||||||||||||||||||||||
onLoadMore(name); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
}, [onLoadMore, hasLoadedMore, name]); | ||||||||||||||||||||||
|
||||||||||||||||||||||
Comment on lines
+267
to
+272
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid auto “Load more” on mount for every facet (perf/cost risk) This eagerly triggers onLoadMore for all FilterGroups, causing N extra metadata calls on mount. Gate it (e.g., only for pinned fields) or remove the auto-run and rely on the button. Gate by pinned field: useEffect(() => {
- if (onLoadMore && !hasLoadedMore) {
- onLoadMore(name);
- }
-}, [onLoadMore, hasLoadedMore, name]);
+ if (onLoadMore && !hasLoadedMore && isFieldPinned) {
+ onLoadMore(name);
+ }
+}, [onLoadMore, hasLoadedMore, name, isFieldPinned]); 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||
const augmentedOptions = useMemo(() => { | ||||||||||||||||||||||
const selectedSet = new Set([ | ||||||||||||||||||||||
...selectedValues.included, | ||||||||||||||||||||||
|
@@ -381,6 +417,7 @@ const DBSearchPageFiltersComponent = ({ | |||||||||||||||||||||
analysisMode, | ||||||||||||||||||||||
setAnalysisMode, | ||||||||||||||||||||||
sourceId, | ||||||||||||||||||||||
sourceType, | ||||||||||||||||||||||
showDelta, | ||||||||||||||||||||||
denoiseResults, | ||||||||||||||||||||||
setDenoiseResults, | ||||||||||||||||||||||
|
@@ -415,39 +452,15 @@ const DBSearchPageFiltersComponent = ({ | |||||||||||||||||||||
const [showMoreFields, setShowMoreFields] = useState(false); | ||||||||||||||||||||||
|
||||||||||||||||||||||
const keysToFetch = useMemo(() => { | ||||||||||||||||||||||
if (!data) { | ||||||||||||||||||||||
return []; | ||||||||||||||||||||||
// Override keys for specific source types | ||||||||||||||||||||||
if (sourceType && sourceType in serviceMapOverride) { | ||||||||||||||||||||||
return getKeysForSourceType(sourceType); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
const strings = data | ||||||||||||||||||||||
.sort((a, b) => { | ||||||||||||||||||||||
// First show low cardinality fields | ||||||||||||||||||||||
const isLowCardinality = (type: string) => | ||||||||||||||||||||||
type.includes('LowCardinality'); | ||||||||||||||||||||||
return isLowCardinality(a.type) && !isLowCardinality(b.type) ? -1 : 1; | ||||||||||||||||||||||
}) | ||||||||||||||||||||||
.filter( | ||||||||||||||||||||||
field => field.jsType && ['string'].includes(field.jsType), | ||||||||||||||||||||||
// todo: add number type with sliders :D | ||||||||||||||||||||||
) | ||||||||||||||||||||||
.map(({ path, type }) => { | ||||||||||||||||||||||
return { type, path: mergePath(path) }; | ||||||||||||||||||||||
}) | ||||||||||||||||||||||
.filter( | ||||||||||||||||||||||
field => | ||||||||||||||||||||||
showMoreFields || | ||||||||||||||||||||||
field.type.includes('LowCardinality') || // query only low cardinality fields by default | ||||||||||||||||||||||
Object.keys(filterState).includes(field.path) || // keep selected fields | ||||||||||||||||||||||
isFieldPinned(field.path), // keep pinned fields | ||||||||||||||||||||||
) | ||||||||||||||||||||||
.map(({ path }) => path) | ||||||||||||||||||||||
.filter( | ||||||||||||||||||||||
path => | ||||||||||||||||||||||
!['body', 'timestamp', '_hdx_body'].includes(path.toLowerCase()), | ||||||||||||||||||||||
); | ||||||||||||||||||||||
|
||||||||||||||||||||||
return strings; | ||||||||||||||||||||||
}, [data, filterState, showMoreFields]); | ||||||||||||||||||||||
console.error('nishant is here === ', sourceType); | ||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||
// For other source types, return empty array to use default behavior | ||||||||||||||||||||||
// This allows the system to fetch all available keys from metadata | ||||||||||||||||||||||
return []; | ||||||||||||||||||||||
}, [sourceType]); | ||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||
|
||||||||||||||||||||||
// Special case for live tail | ||||||||||||||||||||||
const [dateRange, setDateRange] = useState<[Date, Date]>( | ||||||||||||||||||||||
|
@@ -471,10 +484,11 @@ const DBSearchPageFiltersComponent = ({ | |||||||||||||||||||||
} = useGetKeyValues({ | ||||||||||||||||||||||
chartConfigs: { ...chartConfig, dateRange }, | ||||||||||||||||||||||
limit: keyLimit, | ||||||||||||||||||||||
keys: keysToFetch, | ||||||||||||||||||||||
keys: getKeysForSourceType(sourceType), | ||||||||||||||||||||||
}); | ||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||
|
||||||||||||||||||||||
const [extraFacets, setExtraFacets] = useState<Record<string, string[]>>({}); | ||||||||||||||||||||||
|
||||||||||||||||||||||
const [loadMoreLoadingKeys, setLoadMoreLoadingKeys] = useState<Set<string>>( | ||||||||||||||||||||||
new Set(), | ||||||||||||||||||||||
); | ||||||||||||||||||||||
|
@@ -509,11 +523,13 @@ const DBSearchPageFiltersComponent = ({ | |||||||||||||||||||||
}); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
}, | ||||||||||||||||||||||
[chartConfig, setExtraFacets, dateRange], | ||||||||||||||||||||||
[chartConfig, setExtraFacets, dateRange, sourceType], | ||||||||||||||||||||||
); | ||||||||||||||||||||||
Comment on lines
+647
to
648
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Fix callback dependencies (avoid stale facets config; drop unused sourceType)
- [chartConfig, setExtraFacets, dateRange, sourceType],
+ [facetsChartConfig, dateRange], 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||
|
||||||||||||||||||||||
const shownFacets = useMemo(() => { | ||||||||||||||||||||||
const _facets: { key: string; value: string[] }[] = []; | ||||||||||||||||||||||
|
||||||||||||||||||||||
//for filters | ||||||||||||||||||||||
for (const facet of facets ?? []) { | ||||||||||||||||||||||
// don't include empty facets, unless they are already selected | ||||||||||||||||||||||
const filter = filterState[facet.key]; | ||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix CODE_VERSION environment variable
The
ENV CODE_VERSION=2.1.1
hardcodes the value and overrides the ARG, making the build argument ineffective.🤖 Prompt for AI Agents