Skip to content

Commit 4cca9b0

Browse files
committed
add otel sidecar to llamastack deployment
Signed-off-by: sallyom <somalley@redhat.com>
1 parent 02d9e71 commit 4cca9b0

3 files changed

Lines changed: 85 additions & 14 deletions

File tree

kubernetes/llama-stack/deployment.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ spec:
88
app: llamastack
99
template:
1010
metadata:
11-
#annotations:
12-
# sidecar.opentelemetry.io/inject: otelsidecar
11+
annotations:
12+
sidecar.opentelemetry.io/inject: llamastack-otelsidecar
1313
labels:
1414
app: llamastack
1515
spec:
@@ -47,7 +47,7 @@ spec:
4747
- name: OTEL_SERVICE_NAME
4848
value: om-llamastack
4949
- name: OTEL_TRACE_ENDPOINT
50-
value: 'http://otel-collector-collector.observability-hub.svc.cluster.local:4318/v1/traces'
50+
value: 'http://localhost:4318/v1/traces'
5151
- name: SAFETY_MODEL
5252
value: meta-llama/Llama-Guard-3-8B
5353
- name: SAFETY_VLLM_URL
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Once this exists, any pod with the template.metadata.annotation below will send metrics
2+
# to observability-hub:
3+
# sidecar.opentelemetry.io/inject: llamastack-otelsidecar
4+
apiVersion: opentelemetry.io/v1beta1
5+
kind: OpenTelemetryCollector
6+
metadata:
7+
name: llamastack-otelsidecar
8+
spec:
9+
observability:
10+
metrics: {}
11+
deploymentUpdateStrategy: {}
12+
config:
13+
exporters:
14+
debug: {}
15+
otlphttp:
16+
# all sidecars export to the central observability-hub otel-collector, then be
17+
# exported to various backends from there (in-cluster, external 3rd party)
18+
# this is deployed with ../observability/otel-collector manifests
19+
# see ../observability/README.md for how to deploy this collector
20+
endpoint: 'http://otel-collector-collector.observability-hub.svc.cluster.local:4318'
21+
tls:
22+
insecure: true
23+
processors: {}
24+
receivers:
25+
otlp:
26+
protocols:
27+
grpc: {}
28+
http: {}
29+
service:
30+
pipelines:
31+
traces:
32+
exporters:
33+
- debug
34+
- otlphttp
35+
receivers:
36+
- otlp
37+
telemetry:
38+
metrics:
39+
address: '0.0.0.0:8888'
40+
mode: sidecar
41+
resources: {}
42+
podDnsConfig: {}
43+
managementState: managed
44+
upgradeStrategy: automatic
45+
ingress:
46+
route: {}
47+
daemonSetUpdateStrategy: {}
48+
targetAllocator:
49+
allocationStrategy: consistent-hashing
50+
filterStrategy: relabel-config
51+
observability:
52+
metrics: {}
53+
prometheusCR:
54+
scrapeInterval: 30s
55+
resources: {}
56+
replicas: 1
57+
ipFamilyPolicy: SingleStack
58+

kubernetes/observability/README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,34 +65,47 @@ However, if exporting off-cluster to a 3rd party observability vendor, the colle
6565
and can provide a single place with which to receive telemetry from various workloads and export as a single authenticated and
6666
secure OTLP stream.
6767

68+
#### Central OpenTelemetry Collector
69+
6870
To create a central opentelemetry-collector, update the
6971
[otel-collector/otel-collector.yaml](./otel-collector/otel-collector.yaml) to match your requirements and then apply.
7072

7173
```bash
7274
oc apply --kustomize ./otel-collector -n observability-hub
7375
```
7476

75-
### OpenTelemetryCollector Sidecars deployment
77+
#### OpenTelemetryCollector Sidecars deployment
7678

7779
You can add individual metrics endpoints to the central otel-collector in observability-hub, but
7880
another way is to add otel-collector sidecar containers to individual deployments throughout the
7981
cluster. Paired with an annotation on the deployment, telemetry will be exported as configured.
80-
Any deployment with the annotation below will receive and export telemetry as configured in the
82+
83+
Any deployment with the template.metadata.annotations `sidecar.opentelemetry.io/inject: vllm-otelsidecar`
84+
will receive and export telemetry as configured in the
8185
[otel-collector-vllm-sidecar.yaml](./otel-collector/otel-collector-vllm-sidecar.yaml).
8286

83-
The example here will add an otel-collector sidecar custom resource to the `llama-serve` namespace,
84-
and to trigger a sidecar container, annotate any deployment's `template.metadata.annotations` with:
85-
`sidecar.opentelemetry.io/inject: vllm-otelsidecar`
87+
Any deployment with the template.metadata.annotations `sidecar.opentelemetry.io/inject: llamastack-otelsidecar`
88+
will receive and export telemetry as configured in the
89+
[otel-collector-llamstack-sidecar.yaml](./otel-collector/otel-collector-llamastack-sidecar.yaml).
90+
91+
The example below will add otel-collector sidecar custom resources to the `llama-serve` namespace,
92+
and upon a scale down, scale up of the deployments with the added annotations, sidecar otel-collector
93+
containers will be added to the pods.
8694

8795
```bash
88-
oc apply -f ./otel-collector/otel-collector-vllm-sidecar.yaml
96+
oc apply -f ./otel-collector/otel-collector-vllm-sidecar.yaml -n llama-serve
97+
oc apply -f ./otel-collector/otel-collector-llamastack-sidecar.yaml -n llama-serve
98+
99+
# Then, annotate whatever deployment you'd like to collect telemetry from
100+
# Add the annotation to the deployment's `template.metadata.annotations` from the console.
101+
# OR
102+
# Patch or modify the llamastack and vLLM deployments with the appropriate annotation.
103+
# Replace `deployment-name`, `namespace`, and `name-of-otelsideccar` in the below command.
89104

90-
# Then, annotate whatever vllm deployment you'd like to collect metrics from
91-
# Or, add the annotation to the deployment's `template.metadata.annotations` from the console.
92-
oc patch deployment <deployment-name> \
93-
-n <namespace> \
105+
oc patch deployment deployment-name \
106+
-n namespace \
94107
--type='merge' \
95-
-p '{"spec":{"template":{"metadata":{"annotations":{"sidecar.opentelemetry.io/inject":"vllm-otelsidecar"}}}}}'
108+
-p '{"spec":{"template":{"metadata":{"annotations":{"sidecar.opentelemetry.io/inject":"name-of-otelsidecar"}}}}}'
96109
```
97110

98111
### Cluster Observability Operator Tracing UIPlugin

0 commit comments

Comments
 (0)