Skip to content

Commit ddaafca

Browse files
elieserrwozniakjan
authored andcommitted
basic instrumentation for the operator
Signed-off-by: Elieser Pereira <[email protected]>
1 parent c343977 commit ddaafca

File tree

22 files changed

+1078
-17
lines changed

22 files changed

+1078
-17
lines changed

.github/workflows/linkinator.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ jobs:
3434
--retry-wait-time 2
3535
--timeout 30
3636
--github-token ${{ secrets.GITHUB_TOKEN }}
37-
--exclude '^https://github\.com/kedacore/http-add-on/pkgs/container/http-add-on-interceptor$'
38-
--exclude '^https://github\.com/kedacore/http-add-on/pkgs/container/http-add-on-operator$'
39-
--exclude '^https://github\.com/kedacore/http-add-on/pkgs/container/http-add-on-scaler$'
40-
--exclude '^http://opentelemetry-collector\.open-telemetry-system:4318$'
41-
--exclude '^http://opentelemetry-collector\.open-telemetry-system:4318/$'
42-
--exclude '^http://opentelemetry-collector\.open-telemetry-system:4318/v1/traces$'
37+
--exclude '^https://github\.com/kedacore/http-add-on/pkgs/container/http-add-on-(interceptor|operator|scaler)(/.*)?$'
38+
--exclude '^http://opentelemetry-collector\.open-telemetry-system:431[7-8](/.*)?$'
4339
--exclude '^https://www\.gnu\.org/software/make/$'
4440
"./**/*.md"

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This changelog keeps track of work items that have been completed and are ready
3131

3232
### Improvements
3333

34-
- **General**: TODO ([#TODO](https://github.com/kedacore/http-add-on/issues/TODO))
34+
- **General**: Add prometehus and otel instrumentation for the operator ([#965](https://github.com/kedacore/http-add-on/issues/965))
3535

3636
### Fixes
3737

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ deploy: manifests kustomize ## Deploy to the K8s cluster specified in ~/.kube/co
230230
cd config/operator && \
231231
$(KUSTOMIZE) edit set image ghcr.io/kedacore/http-add-on-operator=${IMAGE_OPERATOR_VERSIONED_TAG}
232232

233+
cd config/operator && \
234+
$(KUSTOMIZE) edit add patch --path e2e-test/otel/deployment.yaml --group apps --kind Deployment --name operator --version v1
235+
233236
$(KUSTOMIZE) build config/default | kubectl apply -f -
234237

235238
undeploy:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: operator
5+
spec:
6+
replicas: 1
7+
template:
8+
spec:
9+
containers:
10+
- name: operator
11+
env:
12+
- name: OTEL_PROM_EXPORTER_ENABLED
13+
value: "true"
14+
- name: OTEL_PROM_EXPORTER_PORT
15+
value: "8080"
16+
- name: OTEL_EXPORTER_OTLP_METRICS_ENABLED
17+
value: "true"
18+
- name: OTEL_EXPORTER_OTLP_ENDPOINT
19+
value: "http://opentelemetry-collector.open-telemetry-system:4318"
20+
- name: OTEL_METRIC_EXPORT_INTERVAL
21+
value: "1"
22+
- name: OTEL_EXPORTER_OTLP_PROTOCOL
23+
value: "http"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- deployment.yaml

config/operator/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ resources:
55
- role.yaml
66
- role_binding.yaml
77
- service_account.yaml
8+
- metrics.service.yaml
89
labels:
910
- includeSelectors: true
1011
includeTemplates: true
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: operator-metrics
5+
spec:
6+
type: ClusterIP
7+
ports:
8+
- name: metrics
9+
protocol: TCP
10+
port: 8080
11+
targetPort: metrics

docs/faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ However, Osiris and KEDA-HTTP differ in several ways:
2222
Knative Serving and KEDA-HTTP both have core support for autoscaling, including scale-to-zero of compute workloads. KEDA-HTTP is focused solely on deploying production-grade autoscaling HTTP applications, while Knative builds in additional functionality:
2323

2424
- Pure [event-based workloads](https://knative.dev/docs/eventing/). [KEDA core](https://github.com/kedacore/keda), without KEDA-HTTP, can support such workloads natively.
25-
- Complex deployment strategies like [blue-green](https://knative.dev/docs/serving/samples/blue-green-deployment/).
26-
- Supporting other autoscaling mechanisms beyond the built-in [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/), such as the [Knative Pod Autoscaler (KPA)](https://knative.dev/docs/serving/autoscaling/autoscaling-concepts/#knative-pod-autoscaler-kpa).
25+
- Complex deployment strategies like [blue-green](https://knative.dev/docs/serving/traffic-management/#routing-and-managing-traffic-with-bluegreen-deployment).
26+
- Supporting other autoscaling mechanisms beyond the built-in [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/), such as the [Knative Pod Autoscaler (KPA)](https://knative.dev/docs/serving/autoscaling/autoscaler-types/#knative-pod-autoscaler-kpa).
2727

2828
Additionally, Knative supports a service mesh, while KEDA-HTTP does not out of the box (support for that is forthcoming).
2929

docs/install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ There are a few values that you can pass to the above `helm install` command by
5252
helm install http-add-on kedacore/keda-add-ons-http --create-namespace --namespace ${NAMESPACE} --set images.tag=canary
5353
```
5454

55-
For an exhaustive list of configuration options, see the official HTTP Add-on chart [values.yaml file](https://github.com/kedacore/charts/blob/master/http-add-on/values.yaml).
55+
For an exhaustive list of configuration options, see the official HTTP Add-on chart [values.yaml file](https://github.com/kedacore/charts/blob/main/http-add-on/values.yaml).
5656

5757
### A Note for Developers and Local Cluster Users
5858

docs/operate.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ There are currently 2 supported methods for exposing metrics from the intercepto
99
### Configuring the Prometheus compatible metrics endpoint
1010
When configured, the interceptor proxy can expose metrics on a Prometheus compatible endpoint.
1111

12-
This endpoint can be enabled by setting the `OTEL_PROM_EXPORTER_ENABLED` environment variable to `true` on the interceptor deployment (`true` by default) and by setting `OTEL_PROM_EXPORTER_PORT` to an unused port for the endpoint to be made avaialble on (`2223` by default).
12+
This endpoint can be enabled by setting the `OTEL_PROM_EXPORTER_ENABLED` environment variable to `true` on the interceptor deployment (`true` by default) and by setting `OTEL_PROM_EXPORTER_PORT` to an unused port for the endpoint to be made available on (`2223` by default).
1313

1414
### Configuring the OTEL HTTP exporter
1515
When configured, the interceptor proxy can export metrics to a OTEL HTTP collector.
@@ -71,3 +71,29 @@ Optional variables
7171
`OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` - The batcher timeout in seconds to send batch of data points (`5` by default)
7272

7373
### Configuring Service Failover
74+
75+
# Configuring metrics for the KEDA HTTP Add-on Operator
76+
77+
### Exportable metrics:
78+
* **keda_http_scaled_object_total** - the number of http_scaled_objects
79+
80+
There are currently 2 supported methods for exposing metrics from the operator - via a Prometheus compatible metrics endpoint or by pushing metrics to a OTEL HTTP collector.
81+
82+
### Configuring the Prometheus compatible metrics endpoint
83+
When configured, the operator can expose metrics on a Prometheus compatible endpoint.
84+
85+
This endpoint can be enabled by setting the `OTEL_PROM_EXPORTER_ENABLED` environment variable to `true` on the operator deployment (`true` by default) and by setting `OTEL_PROM_EXPORTER_PORT` to an unused port for the endpoint to be made available on (`8080` by default).
86+
87+
### Configuring the OTEL HTTP exporter
88+
89+
When configured, the operator can export metrics to a OTEL HTTP collector.
90+
91+
The OTEL exporter can be enabled by setting the `OTEL_EXPORTER_OTLP_METRICS_ENABLED` environment variable to `true` on the operator deployment (`false` by default). When enabled, the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable must also be configured so the exporter knows what collector to send the metrics to (e.g. http://opentelemetry-collector.open-telemetry-system:4318).
92+
93+
If you need to provide any headers such as authentication details in order to utilise your OTEL collector you can add them into the `OTEL_EXPORTER_OTLP_HEADERS` environment variable. The frequency at which the metrics are exported can be configured by setting `OTEL_METRIC_EXPORT_INTERVAL` to the number of seconds you require between each export interval (`30` by default).
94+
95+
The `OTEL_EXPORTER_OTLP_PROTOCOL` defaults to `http`
96+
97+
### Configuring the OTEL GRPC exporter
98+
99+
Please note that using `OTEL_EXPORTER_OTLP_PROTOCOL` will allows you to set it up to `grpc` to connect to otel collector. Also `OTEL_EXPORTER_OTLP_ENDPOINT` should be set to the right endpoint (eg: http://opentelemetry-collector.open-telemetry-system:4317)

0 commit comments

Comments
 (0)