-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
transaction_log Metricset for MSSQL Module (also db metricset removal) #10109
transaction_log Metricset for MSSQL Module (also db metricset removal) #10109
Conversation
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.
+1 on this change. Left a few minor comments.
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.
Great change, everything looks much more clear now 🙂
x-pack/metricbeat/module/mssql/transaction_log/transaction_log_integration_test.go
Show resolved
Hide resolved
x-pack/metricbeat/module/mssql/transaction_log/transaction_log.go
Outdated
Show resolved
Hide resolved
x-pack/metricbeat/module/mssql/transaction_log/transaction_log.go
Outdated
Show resolved
Hide resolved
dd8a9d9
to
fbe27f2
Compare
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.
Thanks for addressing all the comments, I have added some extra observations, let me know what you think. In any case I think this is good to go 👍
x-pack/metricbeat/module/mssql/transaction_log/_meta/fields.yml
Outdated
Show resolved
Hide resolved
return m.db.Close() | ||
} | ||
|
||
func (m *MetricSet) getLogSpaceUsageForDb(dbName string) (result common.MapStr, err error) { |
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.
Not sure of the benefits of using named return values here, but ok.
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.
I personally prefer not to use named returns and only if it is really need like in defer functions. It makes from my perspective code more readable. @sayden could you update this?
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.
Changed. I see the benefits and I also have my own preferences. Now it has more code and it's not super clear that it's returning a nil at the end (if you don't look up at the return values... but I thought that this is what we wanted to avoid).
Please, this have been like this for days if not weeks, next time, try to make this comments earlier.
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.
Thanks for adjusting it, appreciate it. Not sure i can follow your comment above as now if I look at the end of the method it's very clear, no error is returned.
Sorry that we missed that in previous reviews but I think initially we focused on the high level details like naming before going into the details.
x-pack/metricbeat/module/mssql/transaction_log/transaction_log.go
Outdated
Show resolved
Hide resolved
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.
LGTM.
I think it needs an other make update
.
0887359
to
bd5b623
Compare
I was running |
Good question. As all the docs are in OSS the answer is probably yes for now but agree it's not optimal. We should clean this up more as soon as we migrated all to mage. @andrewkroh This might also interest you. |
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.
CI failures should not be related.
Summary
transaction_log
Metricset in MSSQL module.db
Metricset.fetcher.go
file with the abstractions that we'll use in the SQL helper.transaction_log
MetricsetIncludes information about the log space usage and general log stats like backup size, time elapsed since last backup or log size since last backup.
Removal / Renaming of
db
MetricsetAfter careful anaysis,
db
naming had 3 problems:db
metricset because, all in all, 90% of metrics are part of a database.db
means nothing and everything. A user will face the question "do I want to activatedb
metricset? Yes, of course, always! I want metrics from the database!" So the answer was always "Yes".Removal of
fetcher.go
fileI was using an abstraction layer to perform, parse and emit metrics based on the queries that were provided. We decided to make it more explicit and less abstract to improve clarity and maintenance. The only metricset using the abstraction layer was
db
so now that it's removed, the file could be removed too.It also forced to remove a forgotten reference in
performance
metricset which is included in this PR.GA
data.json
exists and an automated way to generate it exists (go test -data
)