Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
qorus
prometheus
Commits
302148fd
Commit
302148fd
authored
Jan 16, 2019
by
Matt Layher
Browse files
*: apply gofmt -s
Signed-off-by:
Matt Layher
<
mdlayher@gmail.com
>
parent
45c8b084
Changes
11
Hide whitespace changes
Inline
Side-by-side
cmd/prometheus/main_test.go
View file @
302148fd
...
...
@@ -195,7 +195,7 @@ func TestSendAlerts(t *testing.T) {
}{
{
in
:
[]
*
rules
.
Alert
{
&
rules
.
Alert
{
{
Labels
:
[]
labels
.
Label
{{
Name
:
"l1"
,
Value
:
"v1"
}},
Annotations
:
[]
labels
.
Label
{{
Name
:
"a2"
,
Value
:
"v2"
}},
ActiveAt
:
time
.
Unix
(
1
,
0
),
...
...
@@ -204,7 +204,7 @@ func TestSendAlerts(t *testing.T) {
},
},
exp
:
[]
*
notifier
.
Alert
{
&
notifier
.
Alert
{
{
Labels
:
[]
labels
.
Label
{{
Name
:
"l1"
,
Value
:
"v1"
}},
Annotations
:
[]
labels
.
Label
{{
Name
:
"a2"
,
Value
:
"v2"
}},
StartsAt
:
time
.
Unix
(
2
,
0
),
...
...
@@ -215,7 +215,7 @@ func TestSendAlerts(t *testing.T) {
},
{
in
:
[]
*
rules
.
Alert
{
&
rules
.
Alert
{
{
Labels
:
[]
labels
.
Label
{{
Name
:
"l1"
,
Value
:
"v1"
}},
Annotations
:
[]
labels
.
Label
{{
Name
:
"a2"
,
Value
:
"v2"
}},
ActiveAt
:
time
.
Unix
(
1
,
0
),
...
...
@@ -224,7 +224,7 @@ func TestSendAlerts(t *testing.T) {
},
},
exp
:
[]
*
notifier
.
Alert
{
&
notifier
.
Alert
{
{
Labels
:
[]
labels
.
Label
{{
Name
:
"l1"
,
Value
:
"v1"
}},
Annotations
:
[]
labels
.
Label
{{
Name
:
"a2"
,
Value
:
"v2"
}},
StartsAt
:
time
.
Unix
(
2
,
0
),
...
...
discovery/manager.go
View file @
302148fd
...
...
@@ -418,7 +418,7 @@ func (m *Manager) registerProviders(cfg sd_config.ServiceDiscoveryConfig, setNam
// It can happen because the combined set of SD configurations is empty
// or because we fail to instantiate all the SD configurations.
add
(
setName
,
func
()
(
Discoverer
,
error
)
{
return
&
StaticProvider
{
TargetGroups
:
[]
*
targetgroup
.
Group
{
&
targetgroup
.
Group
{}}},
nil
return
&
StaticProvider
{
TargetGroups
:
[]
*
targetgroup
.
Group
{{}}},
nil
})
}
}
...
...
discovery/manager_test.go
View file @
302148fd
...
...
@@ -988,7 +988,7 @@ func TestCoordinationWithReceiver(t *testing.T) {
expected
:
[]
expect
{
{
tgs
:
map
[
string
][]
*
targetgroup
.
Group
{
"once1"
:
[]
*
targetgroup
.
Group
{
"once1"
:
{
{
Source
:
"tg1"
,
Targets
:
[]
model
.
LabelSet
{{
"__instance__"
:
"1"
}},
...
...
@@ -998,13 +998,13 @@ func TestCoordinationWithReceiver(t *testing.T) {
},
{
tgs
:
map
[
string
][]
*
targetgroup
.
Group
{
"once1"
:
[]
*
targetgroup
.
Group
{
"once1"
:
{
{
Source
:
"tg1"
,
Targets
:
[]
model
.
LabelSet
{{
"__instance__"
:
"1"
}},
},
},
"mock1"
:
[]
*
targetgroup
.
Group
{
"mock1"
:
{
{
Source
:
"tg2"
,
Targets
:
[]
model
.
LabelSet
{{
"__instance__"
:
"2"
}},
...
...
@@ -1041,7 +1041,7 @@ func TestCoordinationWithReceiver(t *testing.T) {
{
delay
:
2
*
updateDelay
,
tgs
:
map
[
string
][]
*
targetgroup
.
Group
{
"mock1"
:
[]
*
targetgroup
.
Group
{
"mock1"
:
{
{
Source
:
"tg1"
,
Targets
:
[]
model
.
LabelSet
{{
"__instance__"
:
"1"
}},
...
...
@@ -1052,7 +1052,7 @@ func TestCoordinationWithReceiver(t *testing.T) {
{
delay
:
4
*
updateDelay
,
tgs
:
map
[
string
][]
*
targetgroup
.
Group
{
"mock1"
:
[]
*
targetgroup
.
Group
{
"mock1"
:
{
{
Source
:
"tg1"
,
Targets
:
[]
model
.
LabelSet
{{
"__instance__"
:
"1"
}},
...
...
discovery/openstack/instance_test.go
View file @
302148fd
...
...
@@ -69,7 +69,7 @@ func TestOpenstackSDInstanceRefresh(t *testing.T) {
testutil
.
Equals
(
t
,
4
,
len
(
tg
.
Targets
))
for
i
,
lbls
:=
range
[]
model
.
LabelSet
{
model
.
LabelSet
{
{
"__address__"
:
model
.
LabelValue
(
"10.0.0.32:0"
),
"__meta_openstack_instance_flavor"
:
model
.
LabelValue
(
"1"
),
"__meta_openstack_instance_id"
:
model
.
LabelValue
(
"ef079b0c-e610-4dfb-b1aa-b49f07ac48e5"
),
...
...
@@ -79,7 +79,7 @@ func TestOpenstackSDInstanceRefresh(t *testing.T) {
"__meta_openstack_public_ip"
:
model
.
LabelValue
(
"10.10.10.2"
),
"__meta_openstack_address_pool"
:
model
.
LabelValue
(
"private"
),
},
model
.
LabelSet
{
{
"__address__"
:
model
.
LabelValue
(
"10.0.0.31:0"
),
"__meta_openstack_instance_flavor"
:
model
.
LabelValue
(
"1"
),
"__meta_openstack_instance_id"
:
model
.
LabelValue
(
"9e5476bd-a4ec-4653-93d6-72c93aa682ba"
),
...
...
@@ -88,7 +88,7 @@ func TestOpenstackSDInstanceRefresh(t *testing.T) {
"__meta_openstack_private_ip"
:
model
.
LabelValue
(
"10.0.0.31"
),
"__meta_openstack_address_pool"
:
model
.
LabelValue
(
"private"
),
},
model
.
LabelSet
{
{
"__address__"
:
model
.
LabelValue
(
"10.0.0.33:0"
),
"__meta_openstack_instance_flavor"
:
model
.
LabelValue
(
"4"
),
"__meta_openstack_instance_id"
:
model
.
LabelValue
(
"9e5476bd-a4ec-4653-93d6-72c93aa682bb"
),
...
...
@@ -98,7 +98,7 @@ func TestOpenstackSDInstanceRefresh(t *testing.T) {
"__meta_openstack_address_pool"
:
model
.
LabelValue
(
"private"
),
"__meta_openstack_tag_env"
:
model
.
LabelValue
(
"prod"
),
},
model
.
LabelSet
{
{
"__address__"
:
model
.
LabelValue
(
"10.0.0.34:0"
),
"__meta_openstack_instance_flavor"
:
model
.
LabelValue
(
"4"
),
"__meta_openstack_instance_id"
:
model
.
LabelValue
(
"9e5476bd-a4ec-4653-93d6-72c93aa682bb"
),
...
...
promql/test_test.go
View file @
302148fd
...
...
@@ -41,10 +41,10 @@ func TestLazyLoader_WithSamplesTill(t *testing.T) {
metric1 1+1x10
`
,
testCases
:
[]
testCase
{
testCase
{
{
ts
:
time
.
Unix
(
40
,
0
),
series
:
[]
Series
{
Series
{
{
Metric
:
labels
.
FromStrings
(
"__name__"
,
"metric1"
),
Points
:
[]
Point
{
{
0
,
1
},
{
10000
,
2
},
{
20000
,
3
},
{
30000
,
4
},
{
40000
,
5
},
...
...
@@ -52,10 +52,10 @@ func TestLazyLoader_WithSamplesTill(t *testing.T) {
},
},
},
testCase
{
{
ts
:
time
.
Unix
(
10
,
0
),
series
:
[]
Series
{
Series
{
{
Metric
:
labels
.
FromStrings
(
"__name__"
,
"metric1"
),
Points
:
[]
Point
{
{
0
,
1
},
{
10000
,
2
},
{
20000
,
3
},
{
30000
,
4
},
{
40000
,
5
},
...
...
@@ -63,10 +63,10 @@ func TestLazyLoader_WithSamplesTill(t *testing.T) {
},
},
},
testCase
{
{
ts
:
time
.
Unix
(
60
,
0
),
series
:
[]
Series
{
Series
{
{
Metric
:
labels
.
FromStrings
(
"__name__"
,
"metric1"
),
Points
:
[]
Point
{
{
0
,
1
},
{
10000
,
2
},
{
20000
,
3
},
{
30000
,
4
},
{
40000
,
5
},
{
50000
,
6
},
{
60000
,
7
},
...
...
@@ -83,16 +83,16 @@ func TestLazyLoader_WithSamplesTill(t *testing.T) {
metric2 1+1x100
`
,
testCases
:
[]
testCase
{
testCase
{
// Adds all samples of metric1.
{
// Adds all samples of metric1.
ts
:
time
.
Unix
(
70
,
0
),
series
:
[]
Series
{
Series
{
{
Metric
:
labels
.
FromStrings
(
"__name__"
,
"metric1"
),
Points
:
[]
Point
{
{
0
,
1
},
{
10000
,
1
},
{
20000
,
1
},
{
30000
,
1
},
{
40000
,
1
},
{
50000
,
1
},
},
},
Series
{
{
Metric
:
labels
.
FromStrings
(
"__name__"
,
"metric2"
),
Points
:
[]
Point
{
{
0
,
1
},
{
10000
,
2
},
{
20000
,
3
},
{
30000
,
4
},
{
40000
,
5
},
{
50000
,
6
},
{
60000
,
7
},
{
70000
,
8
},
...
...
@@ -100,7 +100,7 @@ func TestLazyLoader_WithSamplesTill(t *testing.T) {
},
},
},
testCase
{
// This tests fix for https://github.com/prometheus/prometheus/issues/5064.
{
// This tests fix for https://github.com/prometheus/prometheus/issues/5064.
ts
:
time
.
Unix
(
300
,
0
),
checkOnlyError
:
true
,
},
...
...
rules/alerting_test.go
View file @
302148fd
...
...
@@ -66,7 +66,7 @@ func TestAlertingRuleLabelsUpdate(t *testing.T) {
)
results
:=
[]
promql
.
Vector
{
promql
.
Vector
{
{
{
Metric
:
labels
.
FromStrings
(
"__name__"
,
"ALERTS"
,
...
...
@@ -79,7 +79,7 @@ func TestAlertingRuleLabelsUpdate(t *testing.T) {
Point
:
promql
.
Point
{
V
:
1
},
},
},
promql
.
Vector
{
{
{
Metric
:
labels
.
FromStrings
(
"__name__"
,
"ALERTS"
,
...
...
@@ -92,7 +92,7 @@ func TestAlertingRuleLabelsUpdate(t *testing.T) {
Point
:
promql
.
Point
{
V
:
1
},
},
},
promql
.
Vector
{
{
{
Metric
:
labels
.
FromStrings
(
"__name__"
,
"ALERTS"
,
...
...
@@ -105,7 +105,7 @@ func TestAlertingRuleLabelsUpdate(t *testing.T) {
Point
:
promql
.
Point
{
V
:
1
},
},
},
promql
.
Vector
{
{
{
Metric
:
labels
.
FromStrings
(
"__name__"
,
"ALERTS"
,
...
...
rules/manager_test.go
View file @
302148fd
...
...
@@ -552,7 +552,7 @@ func TestStaleness(t *testing.T) {
metricSample
[
2
]
.
V
=
42
// reflect.DeepEqual cannot handle NaN.
want
:=
map
[
string
][]
promql
.
Point
{
metric
:
[]
promql
.
Point
{{
0
,
2
},
{
1000
,
3
},
{
2000
,
42
}},
metric
:
{{
0
,
2
},
{
1000
,
3
},
{
2000
,
42
}},
}
testutil
.
Equals
(
t
,
want
,
samples
)
...
...
@@ -588,11 +588,11 @@ func TestCopyState(t *testing.T) {
NewRecordingRule
(
"rule3"
,
nil
,
nil
),
},
seriesInPreviousEval
:
[]
map
[
string
]
labels
.
Labels
{
map
[
string
]
labels
.
Labels
{
"a"
:
nil
},
map
[
string
]
labels
.
Labels
{
"r1"
:
nil
},
map
[
string
]
labels
.
Labels
{
"r2"
:
nil
},
map
[
string
]
labels
.
Labels
{
"r3a"
:
nil
},
map
[
string
]
labels
.
Labels
{
"r3b"
:
nil
},
{
"a"
:
nil
},
{
"r1"
:
nil
},
{
"r2"
:
nil
},
{
"r3a"
:
nil
},
{
"r3b"
:
nil
},
},
evaluationDuration
:
time
.
Second
,
}
...
...
@@ -611,11 +611,11 @@ func TestCopyState(t *testing.T) {
newGroup
.
CopyState
(
oldGroup
)
want
:=
[]
map
[
string
]
labels
.
Labels
{
map
[
string
]
labels
.
Labels
{
"r3a"
:
nil
},
map
[
string
]
labels
.
Labels
{
"r3b"
:
nil
},
{
"r3a"
:
nil
},
{
"r3b"
:
nil
},
nil
,
map
[
string
]
labels
.
Labels
{
"a"
:
nil
},
map
[
string
]
labels
.
Labels
{
"r1"
:
nil
},
{
"a"
:
nil
},
{
"r1"
:
nil
},
nil
,
}
testutil
.
Equals
(
t
,
want
,
newGroup
.
seriesInPreviousEval
)
...
...
scrape/manager_test.go
View file @
302148fd
...
...
@@ -275,7 +275,7 @@ func TestManagerTargetsUpdates(t *testing.T) {
for
x
:=
0
;
x
<
10
;
x
++
{
tgSent
[
strconv
.
Itoa
(
x
)]
=
[]
*
targetgroup
.
Group
{
&
targetgroup
.
Group
{
{
Source
:
strconv
.
Itoa
(
x
),
},
}
...
...
scrape/scrape_test.go
View file @
302148fd
...
...
@@ -81,7 +81,7 @@ func TestDroppedTargetsList(t *testing.T) {
tgs
=
[]
*
targetgroup
.
Group
{
{
Targets
:
[]
model
.
LabelSet
{
model
.
LabelSet
{
model
.
AddressLabel
:
"127.0.0.1:9090"
},
{
model
.
AddressLabel
:
"127.0.0.1:9090"
},
},
},
}
...
...
@@ -352,16 +352,16 @@ func TestScrapePoolRaces(t *testing.T) {
}
sp
:=
newScrapePool
(
newConfig
(),
&
nopAppendable
{},
nil
)
tgts
:=
[]
*
targetgroup
.
Group
{
&
targetgroup
.
Group
{
{
Targets
:
[]
model
.
LabelSet
{
model
.
LabelSet
{
model
.
AddressLabel
:
"127.0.0.1:9090"
},
model
.
LabelSet
{
model
.
AddressLabel
:
"127.0.0.2:9090"
},
model
.
LabelSet
{
model
.
AddressLabel
:
"127.0.0.3:9090"
},
model
.
LabelSet
{
model
.
AddressLabel
:
"127.0.0.4:9090"
},
model
.
LabelSet
{
model
.
AddressLabel
:
"127.0.0.5:9090"
},
model
.
LabelSet
{
model
.
AddressLabel
:
"127.0.0.6:9090"
},
model
.
LabelSet
{
model
.
AddressLabel
:
"127.0.0.7:9090"
},
model
.
LabelSet
{
model
.
AddressLabel
:
"127.0.0.8:9090"
},
{
model
.
AddressLabel
:
"127.0.0.1:9090"
},
{
model
.
AddressLabel
:
"127.0.0.2:9090"
},
{
model
.
AddressLabel
:
"127.0.0.3:9090"
},
{
model
.
AddressLabel
:
"127.0.0.4:9090"
},
{
model
.
AddressLabel
:
"127.0.0.5:9090"
},
{
model
.
AddressLabel
:
"127.0.0.6:9090"
},
{
model
.
AddressLabel
:
"127.0.0.7:9090"
},
{
model
.
AddressLabel
:
"127.0.0.8:9090"
},
},
},
}
...
...
storage/remote/codec_test.go
View file @
302148fd
...
...
@@ -101,11 +101,11 @@ func TestValidateLabelsAndMetricName(t *testing.T) {
func
TestConcreteSeriesSet
(
t
*
testing
.
T
)
{
series1
:=
&
concreteSeries
{
labels
:
labels
.
FromStrings
(
"foo"
,
"bar"
),
samples
:
[]
prompb
.
Sample
{
prompb
.
Sample
{
Value
:
1
,
Timestamp
:
2
}},
samples
:
[]
prompb
.
Sample
{{
Value
:
1
,
Timestamp
:
2
}},
}
series2
:=
&
concreteSeries
{
labels
:
labels
.
FromStrings
(
"foo"
,
"baz"
),
samples
:
[]
prompb
.
Sample
{
prompb
.
Sample
{
Value
:
3
,
Timestamp
:
4
}},
samples
:
[]
prompb
.
Sample
{{
Value
:
3
,
Timestamp
:
4
}},
}
c
:=
&
concreteSeriesSet
{
series
:
[]
storage
.
Series
{
series1
,
series2
},
...
...
web/api/v1/api_test.go
View file @
302148fd
...
...
@@ -1053,7 +1053,7 @@ func TestAdminEndpoints(t *testing.T) {
db
:
tsdb
,
enableAdmin
:
true
,
endpoint
:
snapshotAPI
,
values
:
map
[
string
][]
string
{
"skip_head"
:
[]
string
{
"true"
}},
values
:
map
[
string
][]
string
{
"skip_head"
:
{
"true"
}},
errType
:
errorNone
,
},
...
...
@@ -1061,7 +1061,7 @@ func TestAdminEndpoints(t *testing.T) {
db
:
tsdb
,
enableAdmin
:
true
,
endpoint
:
snapshotAPI
,
values
:
map
[
string
][]
string
{
"skip_head"
:
[]
string
{
"xxx"
}},
values
:
map
[
string
][]
string
{
"skip_head"
:
{
"xxx"
}},
errType
:
errorBadData
,
},
...
...
@@ -1127,7 +1127,7 @@ func TestAdminEndpoints(t *testing.T) {
db
:
tsdb
,
enableAdmin
:
true
,
endpoint
:
deleteAPI
,
values
:
map
[
string
][]
string
{
"match[]"
:
[]
string
{
"123"
}},
values
:
map
[
string
][]
string
{
"match[]"
:
{
"123"
}},
errType
:
errorBadData
,
},
...
...
@@ -1135,7 +1135,7 @@ func TestAdminEndpoints(t *testing.T) {
db
:
tsdb
,
enableAdmin
:
true
,
endpoint
:
deleteAPI
,
values
:
map
[
string
][]
string
{
"match[]"
:
[]
string
{
"up"
},
"start"
:
[]
string
{
"xxx"
}},
values
:
map
[
string
][]
string
{
"match[]"
:
{
"up"
},
"start"
:
{
"xxx"
}},
errType
:
errorBadData
,
},
...
...
@@ -1143,7 +1143,7 @@ func TestAdminEndpoints(t *testing.T) {
db
:
tsdb
,
enableAdmin
:
true
,
endpoint
:
deleteAPI
,
values
:
map
[
string
][]
string
{
"match[]"
:
[]
string
{
"up"
},
"end"
:
[]
string
{
"xxx"
}},
values
:
map
[
string
][]
string
{
"match[]"
:
{
"up"
},
"end"
:
{
"xxx"
}},
errType
:
errorBadData
,
},
...
...
@@ -1151,7 +1151,7 @@ func TestAdminEndpoints(t *testing.T) {
db
:
tsdb
,
enableAdmin
:
true
,
endpoint
:
deleteAPI
,
values
:
map
[
string
][]
string
{
"match[]"
:
[]
string
{
"up"
}},
values
:
map
[
string
][]
string
{
"match[]"
:
{
"up"
}},
errType
:
errorNone
,
},
...
...
@@ -1159,7 +1159,7 @@ func TestAdminEndpoints(t *testing.T) {
db
:
tsdb
,
enableAdmin
:
true
,
endpoint
:
deleteAPI
,
values
:
map
[
string
][]
string
{
"match[]"
:
[]
string
{
"up{job!=
\"
foo
\"
}"
,
"{job=~
\"
bar.+
\"
}"
,
"up{instance!~
\"
fred.+
\"
}"
}},
values
:
map
[
string
][]
string
{
"match[]"
:
{
"up{job!=
\"
foo
\"
}"
,
"{job=~
\"
bar.+
\"
}"
,
"up{instance!~
\"
fred.+
\"
}"
}},
errType
:
errorNone
,
},
...
...
@@ -1167,7 +1167,7 @@ func TestAdminEndpoints(t *testing.T) {
db
:
tsdbWithError
,
enableAdmin
:
true
,
endpoint
:
deleteAPI
,
values
:
map
[
string
][]
string
{
"match[]"
:
[]
string
{
"up"
}},
values
:
map
[
string
][]
string
{
"match[]"
:
{
"up"
}},
errType
:
errorInternal
,
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment