-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PMM-1901 Metrics endpoint and collectors filtering. #40
Conversation
Anton Kucherov seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
assert.Equal(t, expected, len(descs), "%+v", descs) | ||
} | ||
|
||
func TestCollector_Describe_WithOverlappingMetrics(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func TestCollector_Describe_WithOverlappingMetrics
is unused (from unused
)
@@ -13,19 +13,36 @@ import ( | |||
"github.com/percona/rds_exporter/sessions" | |||
) | |||
|
|||
func getExporter(t *testing.T) *Exporter { | |||
func getExporter(t *testing.T, enableMetrics OverlappingMetrics) *Exporter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func getExporter
is unused (from unused
)
assert.Equal(t, expected, len(metrics), "%+v", metrics) | ||
} | ||
|
||
func TestCollector_Collect_WithOverlappingMetrics(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func TestCollector_Collect_WithOverlappingMetrics
is unused (from unused
)
func New(config *config.Config, sessions *sessions.Sessions, enableOverlapping OverlappingMetrics) *Exporter { | ||
var m []Metric | ||
m = append(m, Metrics...) | ||
if enableOverlapping { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one cuddle assignment allowed before if statement (from wsl
)
t.Helper() | ||
|
||
cfg, err := config.Load("../config.yml") | ||
require.NoError(t, err) | ||
client := client.New() | ||
sess, err := sessions.New(cfg.Instances, client.HTTP(), false) | ||
require.NoError(t, err) | ||
return New(cfg, sess) | ||
return New(cfg, sess, enableMetrics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return statements should not be cuddled if block has more than two lines (from wsl
)
log.Warnln("Couldn't create filtered metrics handler:", err) | ||
w.WriteHeader(http.StatusBadRequest) | ||
_, err := w.Write([]byte(fmt.Sprintf("Couldn't create filtered metrics handler: %s", err))) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one cuddle assignment allowed before if statement (from wsl
)
} | ||
return | ||
} | ||
filteredHandler.ServeHTTP(w, r) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expressions should not be cuddled with blocks (from wsl
)
if err := registry.Register(c); err != nil { | ||
return nil, err | ||
} | ||
log.Infof("Collector '%s' was registered", name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expressions should not be cuddled with blocks (from wsl
)
if err := registry.Register(c); err != nil { | ||
return nil, err | ||
} | ||
log.Infof("Collector '%s' was registered", name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expressions should not be cuddled with blocks (from wsl
)
@@ -0,0 +1,63 @@ | |||
package factory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ST1000: at least one file in a package should have a package comment (from stylecheck
)
#23