|
| 1 | +## Adding Monitoring |
| 2 | +To add monitoring to the Feast Feature Server, follow these steps: |
| 3 | + |
| 4 | +### Workflow |
| 5 | + |
| 6 | +Feast instrumentation Using OpenTelemetry and Prometheus - |
| 7 | + |
| 8 | + |
| 9 | +### Deploy Prometheus Operator |
| 10 | +Follow the Prometheus Operator documentation to install the operator - |
| 11 | +https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md |
| 12 | + |
| 13 | +### Deploy OpenTelemetry Operator |
| 14 | +Before installing OTEL Operator, install `cert-manager` and validate the `pods` should spin up -- |
| 15 | +``` |
| 16 | +kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml |
| 17 | +``` |
| 18 | + |
| 19 | +Follow the documentation for further installation steps - |
| 20 | +https://github.com/open-telemetry/opentelemetry-operator |
| 21 | + |
| 22 | +### Configure OpenTelemetry Collector |
| 23 | +Add the OpenTelemetry Collector configuration under the metrics section in your values.yaml file. |
| 24 | + |
| 25 | +Example values.yaml: |
| 26 | + |
| 27 | +``` |
| 28 | +metrics: |
| 29 | + enabled: true |
| 30 | + otelCollector: |
| 31 | + endpoint: "otel-collector.default.svc.cluster.local:4317" #sample |
| 32 | + headers: |
| 33 | + api-key: "your-api-key" |
| 34 | +``` |
| 35 | + |
| 36 | +### Add instrumentation annotation and environment variables in the deployment.yaml |
| 37 | + |
| 38 | +``` |
| 39 | +template: |
| 40 | + metadata: |
| 41 | + {{- with .Values.podAnnotations }} |
| 42 | + annotations: |
| 43 | + {{- toYaml . | nindent 8 }} |
| 44 | + instrumentation.opentelemetry.io/inject-python: "true" |
| 45 | +``` |
| 46 | + |
| 47 | +``` |
| 48 | +- name: OTEL_EXPORTER_OTLP_ENDPOINT |
| 49 | + value: http://{{ .Values.service.name }}-collector.{{ .Release.namespace }}.svc.cluster.local:{{ .Values.metrics.endpoint.port}} |
| 50 | +- name: OTEL_EXPORTER_OTLP_INSECURE |
| 51 | + value: "true" |
| 52 | +``` |
| 53 | + |
| 54 | +### Add checks |
| 55 | +Add metric checks to all manifests and deployment file - |
| 56 | + |
| 57 | +``` |
| 58 | +{{ if .Values.metrics.enabled }} |
| 59 | +apiVersion: opentelemetry.io/v1alpha1 |
| 60 | +kind: Instrumentation |
| 61 | +metadata: |
| 62 | + name: feast-instrumentation |
| 63 | +spec: |
| 64 | + exporter: |
| 65 | + endpoint: http://{{ .Values.service.name }}-collector.{{ .Release.Namespace }}.svc.cluster.local:4318 # This is the default port for the OpenTelemetry Collector |
| 66 | + env: |
| 67 | + propagators: |
| 68 | + - tracecontext |
| 69 | + - baggage |
| 70 | + python: |
| 71 | + env: |
| 72 | + - name: OTEL_METRICS_EXPORTER |
| 73 | + value: console,otlp_proto_http |
| 74 | + - name: OTEL_LOGS_EXPORTER |
| 75 | + value: otlp_proto_http |
| 76 | + - name: OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED |
| 77 | + value: "true" |
| 78 | +{{end}} |
| 79 | +``` |
| 80 | + |
| 81 | +### Add manifests to the chart |
| 82 | +Add Instrumentation, OpenTelemetryCollector, ServiceMonitors, Prometheus Instance and RBAC rules as provided in the [samples/](https://github.com/feast-dev/feast/tree/91540703c483f1cd03b534a1a45bc4ccdcf79f81/infra/charts/feast-feature-server/samples) directory. |
| 83 | + |
| 84 | +For latest updates please refer the official repository - https://github.com/open-telemetry/opentelemetry-operator |
| 85 | + |
| 86 | +### Deploy Feast |
| 87 | +Deploy Feast and set `metrics` value to `true`. |
| 88 | + |
| 89 | +Example - |
| 90 | +``` |
| 91 | +helm install feast-release infra/charts/feast-feature-server --set metric=true --set feature_store_yaml_base64="" |
| 92 | +``` |
| 93 | + |
| 94 | +## See logs |
| 95 | +Once the opentelemetry is deployed, you can search the logs to see the required metrics - |
| 96 | + |
| 97 | +``` |
| 98 | +oc logs otelcol-collector-0 | grep "Name: feast_feature_server_memory_usage\|Value: 0.*" |
| 99 | +oc logs otelcol-collector-0 | grep "Name: feast_feature_server_cpu_usage\|Value: 0.*" |
| 100 | +``` |
| 101 | +``` |
| 102 | + -> Name: feast_feature_server_memory_usage |
| 103 | +Value: 0.579426 |
| 104 | +``` |
| 105 | +``` |
| 106 | +-> Name: feast_feature_server_cpu_usage |
| 107 | +Value: 0.000000 |
| 108 | +``` |
0 commit comments