-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for unmarshalling error for keepequal/dropequal (#2794)
* fix * add require * fixing lint errors * adding unit tests * fixing some yaml * adding few more tests * fixing lint * adding comment * Update cmd/otel-allocator/server/server.go Co-authored-by: Jacob Aronoff <[email protected]> --------- Co-authored-by: Jacob Aronoff <[email protected]>
- Loading branch information
1 parent
d9588b9
commit bef802d
Showing
6 changed files
with
343 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: bug_fix | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) | ||
component: target allocator | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Fix for keepequal/dropequal action | ||
|
||
# One or more tracking issues related to the change | ||
issues: [2793] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
175 changes: 175 additions & 0 deletions
175
cmd/otel-allocator/server/testdata/prom-config-all-actions.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
collector_selector: | ||
matchlabels: | ||
app.kubernetes.io/instance: default.test | ||
app.kubernetes.io/managed-by: opentelemetry-operator | ||
prometheus_cr: | ||
scrape_interval: 60s | ||
config: | ||
scrape_configs: | ||
- job_name: job-replace | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
- source_labels: [__meta_kubernetes_pod_label_test] | ||
action: replace | ||
regex: "test$1replacement" | ||
replacement: "myreplacement$$1" | ||
target_label: "mytarget" | ||
metric_relabel_configs: | ||
- action: replace | ||
source_labels: [city] | ||
separator: "," | ||
regex: (ci.*)(name$) | ||
replacement: "test_newest_1_$1" | ||
target_label: city | ||
- job_name: job-lowercase | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
- source_labels: [__meta_kubernetes_pod_label_test] | ||
action: lowercase | ||
target_label: "mytarget" | ||
metric_relabel_configs: | ||
- action: lowercase | ||
source_labels: [city] | ||
target_label: city | ||
- job_name: job-uppercase | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
- source_labels: [__meta_kubernetes_pod_label_test] | ||
action: uppercase | ||
target_label: "mytarget" | ||
metric_relabel_configs: | ||
- action: uppercase | ||
source_labels: [city] | ||
target_label: city | ||
- job_name: job-keep | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
metric_relabel_configs: | ||
- action: keep | ||
source_labels: [city] | ||
separator: "," | ||
regex: (ci.*)(name$) | ||
- job_name: job-drop | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
- source_labels: [__meta_kubernetes_pod_label_droplabel] | ||
action: drop | ||
regex: "prometheus-reference-app" | ||
metric_relabel_configs: | ||
- action: drop | ||
source_labels: [city] | ||
regex: (ci.*)(name$) | ||
- job_name: job-keepequal | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keepequal | ||
target_label: __meta_kubernetes_pod_label_mylabel | ||
metric_relabel_configs: | ||
- action: keepequal | ||
source_labels: [city] | ||
target_label: city | ||
- job_name: job-dropequal | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
- source_labels: [__meta_kubernetes_pod_label_dropequallabel] | ||
action: dropequal | ||
target_label: "test" | ||
metric_relabel_configs: | ||
- action: dropequal | ||
source_labels: [citytest] | ||
target_label: city | ||
- job_name: job-hashmod | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
- source_labels: [__meta_kubernetes_pod_label_hashmod] | ||
action: hashmod | ||
modulus: 5 | ||
regex: "prometheus-reference-app" | ||
target_label: city | ||
metric_relabel_configs: | ||
- action: hashmod | ||
modulus: 5 | ||
source_labels: [city] | ||
regex: (ci.*)(name$) | ||
target_label: city | ||
- job_name: job-labelmap | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
- source_labels: [__meta_kubernetes_pod_label_hashmod] | ||
action: labelmap | ||
regex: "prometheus-reference-app" | ||
target_label: city | ||
metric_relabel_configs: | ||
- action: labelmap | ||
source_labels: [city] | ||
regex: (ci.*)(name$) | ||
target_label: city | ||
- job_name: job-labeldrop | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
- action: labeldrop | ||
regex: "prometheus-reference-app" | ||
metric_relabel_configs: | ||
- action: labeldrop | ||
regex: (ci.*)(name$) | ||
- job_name: job-labelkeep | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
- action: labelkeep | ||
regex: "prometheus-reference-app" | ||
metric_relabel_configs: | ||
- action: labelkeep | ||
regex: (ci.*)(name$$) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
collector_selector: | ||
matchlabels: | ||
app.kubernetes.io/instance: default.test | ||
app.kubernetes.io/managed-by: opentelemetry-operator | ||
prometheus_cr: | ||
scrape_interval: 60s | ||
config: | ||
scrape_configs: | ||
- job_name: job-no-target-relabel | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
metric_relabel_configs: | ||
- action: replace | ||
source_labels: [city] | ||
separator: "," | ||
regex: (ci.*)(name$) | ||
replacement: "test_newest_1_$1" | ||
target_label: city | ||
- job_name: job-no-metric-relabel | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod | ||
relabel_configs: | ||
- source_labels: [__meta_kubernetes_pod_label_app] | ||
action: keep | ||
regex: "prometheus-reference-app" | ||
- source_labels: [__meta_kubernetes_pod_label_test] | ||
action: lowercase | ||
target_label: "mytarget" | ||
- job_name: job-no-relabel | ||
scheme: http | ||
kubernetes_sd_configs: | ||
- role: pod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
collector_selector: | ||
matchlabels: | ||
app.kubernetes.io/instance: default.test | ||
app.kubernetes.io/managed-by: opentelemetry-operator | ||
prometheus_cr: | ||
scrape_interval: 60s | ||
config: | ||
scrape_configs: |