Repository navigation
feat(lens): coordinate worker releases and bundled installs #44428
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3c500f2
feat(lens): coordinate worker versions and bundled installs
moe-berri fb475d6
test(lens): exercise bundled Compose startup and restart in CI
moe-berri 8cb9084
Merge remote-tracking branch 'origin/main' into litellm_lens_release
moe-berri a2234a7
fix(lens): refund failed model requests without a response
moe-berri cbd4037
test(lens): verify trace persistence in the bundled stack
moe-berri f9ff25b
merge: incorporate current main and the upstream Lens budget fix
moe-berri 243a5c6
fix(lens): align Helm images and isolate Compose storage
moe-berri 34f04ab
fix(lens): reject worker builds without release identity
moe-berri 3defa90
fix(lens): encode Compose credentials and normalize worker versions
moe-berri 61703ef
fix(lens): refuse worker recommendations for unidentified builds
moe-berri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| FROM python:3.12-slim | ||
| ARG LITELLM_RELEASE_TAG="" | ||
| ENV LITELLM_RELEASE_TAG=${LITELLM_RELEASE_TAG} | ||
| WORKDIR /app | ||
| RUN pip install --no-cache-dir httpx==0.28.1 pydantic==2.11.7 | ||
| COPY litellm/proxy/lens/__init__.py litellm/proxy/lens/models.py litellm/proxy/lens/trace_store.py litellm/proxy/lens/analysis.py litellm/proxy/lens/worker.py /app/lens/ | ||
| COPY litellm/proxy/lens/__init__.py litellm/proxy/lens/models.py litellm/proxy/lens/trace_store.py litellm/proxy/lens/analysis.py litellm/proxy/lens/worker.py litellm/proxy/lens/release.py /app/lens/ | ||
| COPY litellm/proxy/lens/prompts/ /app/lens/prompts/ | ||
| USER 65532:65532 | ||
| CMD ["python", "-m", "lens.worker"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| general_settings: | ||
| master_key: os.environ/LITELLM_MASTER_KEY | ||
| tracing: | ||
| store: | ||
| type: clickhouse | ||
| url: os.environ/CLICKHOUSE_URL | ||
| retention_days: 14 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: litellm-lens | ||
|
|
||
| services: | ||
| litellm: | ||
| image: ghcr.io/berriai/litellm:${LITELLM_VERSION:?Set LITELLM_VERSION to a published release, without the v prefix} | ||
| command: ["--config", "/app/lens-config.yaml", "--port", "4000"] | ||
| environment: | ||
| LITELLM_MASTER_KEY: ${LITELLM_MASTER_KEY:?Set a strong master key} | ||
| LITELLM_SALT_KEY: ${LITELLM_SALT_KEY:?Set a permanent encryption key and keep it across upgrades} | ||
| DATABASE_URL: postgresql://litellm:litellm@db:5432/litellm | ||
| STORE_MODEL_IN_DB: "True" | ||
| CLICKHOUSE_URL: http://default:local-lens@clickhouse:8123 | ||
| LENS_WORKER_IMAGE: ghcr.io/berriai/litellm-lens-worker:v${LITELLM_VERSION} | ||
| volumes: | ||
| - ./config.yaml:/app/lens-config.yaml:ro | ||
| ports: | ||
| - "127.0.0.1:${LITELLM_PORT:-4000}:4000" | ||
| depends_on: | ||
| db: | ||
| condition: service_healthy | ||
| clickhouse: | ||
| condition: service_healthy | ||
| restart: unless-stopped | ||
|
|
||
| lens-worker: | ||
| profiles: [lens] | ||
| image: ghcr.io/berriai/litellm-lens-worker:v${LITELLM_VERSION} | ||
| environment: | ||
| LITELLM_URL: http://litellm:4000 | ||
| LENS_WORKER_TOKEN: ${LENS_WORKER_TOKEN:-} | ||
| depends_on: [litellm] | ||
| restart: unless-stopped | ||
| read_only: true | ||
| tmpfs: | ||
| - /tmp:rw,noexec,nosuid,size=${LENS_WORKER_TMP_SIZE:-1g} | ||
| cap_drop: [ALL] | ||
| security_opt: [no-new-privileges:true] | ||
|
|
||
| db: | ||
| image: postgres:16 | ||
| environment: | ||
| POSTGRES_DB: litellm | ||
| POSTGRES_USER: litellm | ||
| POSTGRES_PASSWORD: litellm | ||
| volumes: | ||
| - postgres_data:/var/lib/postgresql/data | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "pg_isready -U litellm -d litellm"] | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 20 | ||
| restart: unless-stopped | ||
|
|
||
| clickhouse: | ||
| image: clickhouse/clickhouse-server:26.9.6.6 | ||
| environment: | ||
| CLICKHOUSE_USER: default | ||
| CLICKHOUSE_PASSWORD: local-lens | ||
| CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: "1" | ||
| volumes: | ||
| - clickhouse_data:/var/lib/clickhouse | ||
| healthcheck: | ||
| test: ["CMD", "clickhouse-client", "--user", "default", "--password", "local-lens", "--query", "SELECT 1"] | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 20 | ||
| restart: unless-stopped | ||
|
|
||
| volumes: | ||
| postgres_data: | ||
| clickhouse_data: | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| {{- if .Values.lensWorker.enabled }} | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: {{ include "litellm.fullname" . }}-lens-worker | ||
| labels: | ||
| {{- include "litellm.commonLabels" . | nindent 4 }} | ||
| app.kubernetes.io/component: lens-worker | ||
| spec: | ||
| replicas: {{ .Values.lensWorker.replicaCount }} | ||
| selector: | ||
| matchLabels: | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| app.kubernetes.io/component: lens-worker | ||
| template: | ||
| metadata: | ||
| labels: | ||
| {{- include "litellm.commonLabels" . | nindent 8 }} | ||
| app.kubernetes.io/component: lens-worker | ||
| spec: | ||
| automountServiceAccountToken: false | ||
| {{- with .Values.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| securityContext: | ||
| runAsNonRoot: true | ||
| runAsUser: 65532 | ||
| runAsGroup: 65532 | ||
| fsGroup: 65532 | ||
| seccompProfile: | ||
| type: RuntimeDefault | ||
| containers: | ||
| - name: lens-worker | ||
| image: "{{ .Values.lensWorker.image.repository }}:{{ .Values.lensWorker.image.tag | default .Chart.AppVersion }}" | ||
|
greptile-apps[bot] marked this conversation as resolved.
Resolved
|
||
| imagePullPolicy: {{ .Values.lensWorker.image.pullPolicy }} | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
| readOnlyRootFilesystem: true | ||
| capabilities: | ||
| drop: [ALL] | ||
| env: | ||
| - name: LITELLM_URL | ||
| value: {{ .Values.lensWorker.url | default (printf "http://%s:%v" (include "litellm.backend.fullname" .) .Values.backend.service.port) | quote }} | ||
| - name: LENS_WORKER_TOKEN | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ required "lensWorker.tokenSecret.name must reference a Lens worker token" .Values.lensWorker.tokenSecret.name | quote }} | ||
| key: {{ .Values.lensWorker.tokenSecret.key | quote }} | ||
| resources: | ||
| {{- toYaml .Values.lensWorker.resources | nindent 12 }} | ||
| volumeMounts: | ||
| - name: tmp | ||
| mountPath: /tmp | ||
| volumes: | ||
| - name: tmp | ||
| emptyDir: | ||
| medium: Memory | ||
| sizeLimit: {{ .Values.lensWorker.tmpSizeLimit }} | ||
| {{- with .Values.lensWorker.nodeSelector }} | ||
| nodeSelector: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.lensWorker.tolerations }} | ||
| tolerations: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.lensWorker.affinity }} | ||
| affinity: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- end }} | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.