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

transaction_log Metricset for MSSQL Module (also db metricset removal) #10109

Merged
merged 2 commits into from
Jan 23, 2019

Conversation

sayden
Copy link
Contributor

@sayden sayden commented Jan 16, 2019

Summary

  • transaction_log Metricset in MSSQL module.
  • Replaces / Removes "old" db Metricset.
  • Removes references to "old" fetcher.go file with the abstractions that we'll use in the SQL helper.

transaction_log Metricset

Includes 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 Metricset

After careful anaysis, db naming had 3 problems:

  • You can merely put everything in a 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 activate db metricset? Yes, of course, always! I want metrics from the database!" So the answer was always "Yes".
  • 80% of the data that was included was about the database log and file space usage so I left only the metrics that were about the log (and left file space usage for a different metricset).

Removal of fetcher.go file

I 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

  • Supported versions are documented
  • Supported operating systems are documented (if applicable)
  • Integration tests
  • System tests
  • Automated checks that all fields are documented
  • Documentation
  • Example data.json exists and an automated way to generate it exists (go test -data)
  • Fields follow naming conventions: https://www.elastic.co/guide/en/beats/devguide/master/event-conventions.html
  • Dashboards exists (if applicable)
  • Kibana Home Tutorial (if applicable)

@sayden sayden added enhancement review Metricbeat Metricbeat Team:Integrations Label for the Integrations team labels Jan 16, 2019
@sayden sayden self-assigned this Jan 16, 2019
@sayden sayden requested a review from a team as a code owner January 16, 2019 13:39
Copy link
Contributor

@ruflin ruflin left a 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.

x-pack/metricbeat/module/mssql/_meta/docs.asciidoc Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/_meta/data.json Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/log.go Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/log.go Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/log.go Outdated Show resolved Hide resolved
Copy link
Member

@jsoriano jsoriano left a 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 🙂

CHANGELOG.next.asciidoc Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/_meta/docs.asciidoc Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/_meta/docs.asciidoc Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/_meta/fields.yml Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/log.go Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/data.go Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/log.go Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/log.go Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/log/log.go Outdated Show resolved Hide resolved
@sayden sayden changed the title Log Metricset for MSSQL Module (also db metricset removal) transaction_log Metricset for MSSQL Module (also db metricset removal) Jan 21, 2019
@sayden sayden force-pushed the feature/xp/mb/mssql-log-metricset branch from dd8a9d9 to fbe27f2 Compare January 23, 2019 08:36
Copy link
Member

@jsoriano jsoriano left a 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 👍

return m.db.Close()
}

func (m *MetricSet) getLogSpaceUsageForDb(dbName string) (result common.MapStr, err error) {
Copy link
Member

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@jsoriano jsoriano dismissed their stale review January 23, 2019 09:35

Requested changes addressed.

Copy link
Contributor

@ruflin ruflin left a 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.

@sayden sayden force-pushed the feature/xp/mb/mssql-log-metricset branch from 0887359 to bd5b623 Compare January 23, 2019 11:10
@sayden sayden requested a review from a team as a code owner January 23, 2019 12:06
@sayden
Copy link
Contributor Author

sayden commented Jan 23, 2019

I was running mage fmt update in Xpack folder instead of make update from OSS folder. Does it make sense that I need to do something in the OSS folder to make an X-Pack module work? Just curious

@ruflin
Copy link
Contributor

ruflin commented Jan 23, 2019

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.

Copy link
Contributor

@ruflin ruflin left a 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.

@sayden sayden merged commit d91d00f into elastic:master Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Metricbeat Metricbeat review Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants