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