From 71110536f11549ad47e97ea4ee58afb29a6000e4 Mon Sep 17 00:00:00 2001 From: Hwansoo Kim Date: Wed, 18 Oct 2023 13:11:25 +0900 Subject: [PATCH 1/2] chore(examples): make directories for examples --- examples/README.md | 5 +++++ examples/scaling-components/aws/README.md | 1 + examples/scaling-components/azure/README.md | 1 + examples/scaling-components/google-cloud/README.md | 1 + examples/scaling-components/kubernetes/README.md | 1 + examples/triggers/README.md | 1 + examples/triggers/cron-expression.md | 1 + examples/triggers/javascript-expression.md | 1 + 8 files changed, 12 insertions(+) create mode 100644 examples/README.md create mode 100644 examples/scaling-components/aws/README.md create mode 100644 examples/scaling-components/azure/README.md create mode 100644 examples/scaling-components/google-cloud/README.md create mode 100644 examples/scaling-components/kubernetes/README.md create mode 100644 examples/triggers/README.md create mode 100644 examples/triggers/cron-expression.md create mode 100644 examples/triggers/javascript-expression.md diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..0ab22988 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,5 @@ +**Examples for Wave Autoscale** + +- Metrics +- Scaling Components +- Plan Triggers \ No newline at end of file diff --git a/examples/scaling-components/aws/README.md b/examples/scaling-components/aws/README.md new file mode 100644 index 00000000..bc37b7a4 --- /dev/null +++ b/examples/scaling-components/aws/README.md @@ -0,0 +1 @@ +**AWS Scaling Components** diff --git a/examples/scaling-components/azure/README.md b/examples/scaling-components/azure/README.md new file mode 100644 index 00000000..739fa06f --- /dev/null +++ b/examples/scaling-components/azure/README.md @@ -0,0 +1 @@ +**Azure Scaling Components** diff --git a/examples/scaling-components/google-cloud/README.md b/examples/scaling-components/google-cloud/README.md new file mode 100644 index 00000000..561a2eda --- /dev/null +++ b/examples/scaling-components/google-cloud/README.md @@ -0,0 +1 @@ +**Google Cloud Scaling Components** diff --git a/examples/scaling-components/kubernetes/README.md b/examples/scaling-components/kubernetes/README.md new file mode 100644 index 00000000..eeb63546 --- /dev/null +++ b/examples/scaling-components/kubernetes/README.md @@ -0,0 +1 @@ +**Kubernetes Scaling Components** diff --git a/examples/triggers/README.md b/examples/triggers/README.md new file mode 100644 index 00000000..a59b259b --- /dev/null +++ b/examples/triggers/README.md @@ -0,0 +1 @@ +**Triggers** diff --git a/examples/triggers/cron-expression.md b/examples/triggers/cron-expression.md new file mode 100644 index 00000000..eeb63546 --- /dev/null +++ b/examples/triggers/cron-expression.md @@ -0,0 +1 @@ +**Kubernetes Scaling Components** diff --git a/examples/triggers/javascript-expression.md b/examples/triggers/javascript-expression.md new file mode 100644 index 00000000..eeb63546 --- /dev/null +++ b/examples/triggers/javascript-expression.md @@ -0,0 +1 @@ +**Kubernetes Scaling Components** From 8b08b409622c253f574aa5f9753bc4a96fdb1de2 Mon Sep 17 00:00:00 2001 From: Hwansoo Kim Date: Wed, 18 Oct 2023 13:13:45 +0900 Subject: [PATCH 2/2] chore(examples): add vector and telegraf directory --- .gitignore | 2 ++ examples/metrics/telegraf/README.md | 1 + examples/metrics/vector/README.md | 1 + .../metrics/vector/prometheus_client.yaml | 19 +++++++++++ .../metrics/vector/prometheus_server.yaml | 33 +++++++++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 examples/metrics/telegraf/README.md create mode 100644 examples/metrics/vector/README.md create mode 100644 examples/metrics/vector/prometheus_client.yaml create mode 100644 examples/metrics/vector/prometheus_server.yaml diff --git a/.gitignore b/.gitignore index 24d5de92..d98e1d40 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,8 @@ wave.db :memory: telegraf*/ vector*/ +!examples/metrics/telegraf/ +!examples/metrics/vector/ # VSCode .vscode/ diff --git a/examples/metrics/telegraf/README.md b/examples/metrics/telegraf/README.md new file mode 100644 index 00000000..28e4c0cf --- /dev/null +++ b/examples/metrics/telegraf/README.md @@ -0,0 +1 @@ +**Metrics Collected By Telegraf** diff --git a/examples/metrics/vector/README.md b/examples/metrics/vector/README.md new file mode 100644 index 00000000..87b67899 --- /dev/null +++ b/examples/metrics/vector/README.md @@ -0,0 +1 @@ +**Metrics Collected By Vector** diff --git a/examples/metrics/vector/prometheus_client.yaml b/examples/metrics/vector/prometheus_client.yaml new file mode 100644 index 00000000..1c0e57b1 --- /dev/null +++ b/examples/metrics/vector/prometheus_client.yaml @@ -0,0 +1,19 @@ +# https://vector.dev/docs/reference/configuration/sources/prometheus_scrape/#query +--- +kind: Metric +id: vector_prometheus_metrics +collector: vector +metadata: + sources: + my_source_id_1: + type: prometheus_scrape + endpoints: ["http://localhost:9090/metrics"] + scrape_interval_secs: 15 + query: + "match[]": + - '{job="somejob"}' + - '{__name__=~"job:.*"}' + sinks: + my_sinks_id: + type: wave-autoscale + inputs: ["my_source_id_1"] # last transform id or source id \ No newline at end of file diff --git a/examples/metrics/vector/prometheus_server.yaml b/examples/metrics/vector/prometheus_server.yaml new file mode 100644 index 00000000..eafdfb56 --- /dev/null +++ b/examples/metrics/vector/prometheus_server.yaml @@ -0,0 +1,33 @@ +# source: https://vector.dev/docs/reference/configuration/sources/http_client/ +# transform: https://vector.dev/docs/reference/configuration/transforms/remap/ +--- +kind: Metric +id: vector_prometheus_metrics +collector: vector +metadata: + sources: + my_source_id_1: + type: http_client + endpoint: "http://34.64.190.189:9090/api/v1/query" + scrape_interval_secs: 30 + query: + "query": + [ + 'rate(istio_request_duration_milliseconds_sum{destination_workload="node-server-dp",response_code="200",reporter="destination"}[1m])', + ] + transforms: + my_transforms_id_1: + inputs: ["my_source_id_1"] + type: remap + source: |- + . = parse_json!(.message) + tally = [] + for_each(array!(.data.result)) -> |_index, value| { + tally = push(tally, {\"name\": \"name_1\", \"tags\": value.metric, \"timestamp\": value.value[0], \"gauge\": {\"value\" : value.value[1]}}) + } + tally + . = tally + sinks: + my_sinks_id: + type: wave-autoscale + inputs: ["my_transforms_id_1"] # last transform id or source id