Skip to content

Commit

Permalink
yamllint 语法检查,不影响业务功能
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroOps-cn committed Mar 28, 2022
1 parent 01e0654 commit f00d4ff
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
linters:
enable:
- staticcheck
disable-all: true
disable-all: true
4 changes: 3 additions & 1 deletion .promu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ repository:
path: github.com/MicroOps-cn/data_exporter
build:
flags: -a -tags netgo
# yamllint disable rule:line-length
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
-X github.com/prometheus/common/version.Branch={{.Branch}}
-X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
-X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
# yamllint enable
tarball:
files:
- examples
- LICENSE
- LICENSE
40 changes: 20 additions & 20 deletions examples/data_exporter.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
collects:
- name: "test-http"
relabel_configs: [ ]
relabel_configs: []
data_format: "json"
datasource:
- type: "http"
Expand All @@ -10,12 +10,12 @@ collects:
relabel_configs:
- target_label: __namespace__
replacement: "node_server"
- source_labels: [ __name__ ]
- source_labels: [__name__]
target_label: name
regex: "([^.]+)\\.metrics\\..+"
replacement: "$1"
action: replace
- source_labels: [ __name__ ]
- source_labels: [__name__]
target_label: __name__
regex: "[^.]+\\.metrics\\.(.+)"
replacement: "$1"
Expand Down Expand Up @@ -74,7 +74,7 @@ collects:
relabel_configs:
- target_label: __namespace__
replacement: "node_server"
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: name
regex: "#([^/]+).*"
datasource:
Expand All @@ -83,10 +83,10 @@ collects:
metrics:
- name: "server cpu"
relabel_configs:
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: __value__
regex: "(?s:.*cpu=([0-9]+).*)"
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: name
regex: "(?s:\\[(.+?)].*)"
- target_label: __name__
Expand All @@ -97,10 +97,10 @@ collects:
__raw__: "(?s:.*)"
- name: "server memory"
relabel_configs:
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: __value__
regex: "(?s:.*memory=([0-9]+).*)"
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: name
regex: "(?s:\\[(.+?)].*)"
- target_label: __name__
Expand All @@ -111,13 +111,13 @@ collects:
__raw__: "(?s:.*)"
- name: "server info"
relabel_configs:
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: hostname
regex: "(?s:.*hostname=(.+?)\n.*)"
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: ip
regex: "(?s:.*ip=([0-9.]+).*)"
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: name
regex: "(?s:\\[(.+?)].*)"
- target_label: __value__
Expand All @@ -133,7 +133,7 @@ collects:
relabel_configs:
- target_label: __namespace__
replacement: "node_server"
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: name
regex: "#([^/]+).*"
datasource:
Expand All @@ -142,10 +142,10 @@ collects:
metrics:
- name: "server cpu"
relabel_configs:
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: __value__
regex: ".*cpu=(.+?)[!/].*"
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: name
regex: ".*@\\[(.+?)].*"
- target_label: __name__
Expand All @@ -156,10 +156,10 @@ collects:
__raw__: ".*"
- name: "server memory"
relabel_configs:
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: __value__
regex: ".*memory=(.+?)[!/].*"
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: name
regex: ".*@\\[(.+?)].*"
- target_label: __name__
Expand All @@ -170,13 +170,13 @@ collects:
__raw__: ".*"
- name: "server info"
relabel_configs:
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: hostname
regex: ".*hostname=(.+?)[!/].*"
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: ip
regex: ".*ip=(.+?)[!/].*"
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
target_label: name
regex: ".*@\\[(.+?)].*"
- target_label: __value__
Expand All @@ -186,4 +186,4 @@ collects:
match:
datapoint: "@.*!"
labels:
__raw__: ".*"
__raw__: ".*"
6 changes: 3 additions & 3 deletions examples/regex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ collects:
- target_label: __value__
replacement: "1"
match:
datapoint: '@\[(?P<name>[^[]+)]/time=(?P<__time__>[-\d :]+)/.+/ip=(?P<ip>[\d.]+)/hostname=(?P<hostname>.+?)!'
datapoint: '@\[(?P<name>[^[]+)]/time=(?P<__time__>[-\d :]+)/.+/ip=(?P<ip>[\d.]+)/hostname=(?P<hostname>.+?)!' # yamllint disable-line
metric_type: gauge
- name: regex - memory
relabel_configs:
Expand All @@ -30,10 +30,10 @@ collects:
metric_type: gauge
- name: regex - cpu
relabel_configs:
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
regex: .*cpu=(\d+).*
target_label: __value__
- source_labels: [ __raw__ ]
- source_labels: [__raw__]
regex: .*@\[(.+?)].*
target_label: name
- target_label: __name__
Expand Down

0 comments on commit f00d4ff

Please sign in to comment.