Skip to content
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

added db stat metrics #1176

Merged
merged 5 commits into from
Nov 24, 2020
Merged

Conversation

tharun208
Copy link
Contributor

Signed-off-by: Tharun rajendrantharun@live.com

Summary

Db Stat Metrics

Full changelog

  • Added Postgres DB stats metrics

Issues resolved

Fix #1068

Documentation

@tharun208 tharun208 requested a review from a team as a code owner November 19, 2020 12:55
Fixes kumahq#1068

Signed-off-by: Tharun <rajendrantharun@live.com>
pkg/plugins/resources/postgres/store.go Outdated Show resolved Hide resolved
pkg/plugins/resources/postgres/store.go Outdated Show resolved Hide resolved
added method BulkRegister in metrics Interface
fixed integration test
Signed-off-by: Tharun <rajendrantharun@live.com>
@@ -267,3 +274,94 @@ func (r *resourceMetaObject) GetCreationTime() time.Time {
func (r *resourceMetaObject) GetModificationTime() time.Time {
return r.ModificationTime
}

func registerAndCollectMetrics(metrics core_metrics.Metrics, dbStats sql.DBStats) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again - you are only collecting the initial metrics about the DB. You need to do db.Stats() inside the closures.

Also change the name for registerMetrics

db, err := common_postgres.ConnectToDb(config)
if err != nil {
return nil, err
}

if err := registerAndCollectMetrics(metrics, db.Stats()); err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add context to the error - could not register DB metrics

Signed-off-by: Tharun <rajendrantharun@live.com>
Copy link
Contributor

@jakubdyszkiewicz jakubdyszkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thanks!

@jakubdyszkiewicz jakubdyszkiewicz merged commit 34e2b13 into kumahq:master Nov 24, 2020
@tharun208 tharun208 deleted the feat/db_stats branch November 24, 2020 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DB connection metric
2 participants