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

allow multi instance sql server #30859

Merged
merged 8 commits into from
Apr 25, 2022

Conversation

cwuethrich
Copy link
Contributor

@cwuethrich cwuethrich commented Mar 16, 2022

Please label this PR with one of the following labels, depending on the scope of your change:

  • Bug

What does this PR do?

This pull requests allow to use metricbeat with MSSQL and named instances.

Why is it important?

Bigger companies often don't use MSSQL in a docker container. Often they have one server with multiple named instances. This change allows them to use metricbeat as well.

Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have made corresponding change to the default configuration files
- [ ] I have added tests that prove my fix is effective or that my feature works

  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • Verify changes SQL statement

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Mar 16, 2022
@mergify
Copy link
Contributor

mergify bot commented Mar 16, 2022

This pull request does not have a backport label. Could you fix it @cwuethrich? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Mar 16, 2022
@mergify
Copy link
Contributor

mergify bot commented Mar 16, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b metricbeat-mssql-instance upstream/metricbeat-mssql-instance
git merge upstream/main
git push upstream metricbeat-mssql-instance

@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 16, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-04-25T17:44:36.816+0000

  • Duration: 32 min 42 sec

Test stats 🧪

Test Results
Failed 0
Passed 2
Skipped 2
Total 4

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@mtojek mtojek added the Team:Integrations Label for the Integrations team label Mar 21, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Mar 21, 2022
@rdner
Copy link
Member

rdner commented Apr 7, 2022

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Apr 7, 2022

update

✅ Branch has been successfully updated

@mergify mergify bot requested review from a team as code owners April 7, 2022 07:58
@rdner
Copy link
Member

rdner commented Apr 7, 2022

jenkins run tests

@rdner rdner requested a review from adriansr April 7, 2022 09:49
@rdner
Copy link
Member

rdner commented Apr 7, 2022

I think we could merge it without fixing the linter issue, @adriansr could you have a look at the code change?

@adriansr
Copy link
Contributor

adriansr commented Apr 7, 2022

I'm not comfortable reviewing changes to this large SQL expression. @sayden can you have a look as the original author?

@adriansr adriansr requested review from sayden and removed request for adriansr April 7, 2022 10:20
@sayden
Copy link
Contributor

sayden commented Apr 7, 2022

@cwuethrich thanks for contributing this. Let me ask you a couple of important things:

  • Is this PR changin the key of any of the output events?
  • How this query will behave with beats multi-instance? For me it seems it will generate duplicate data.

Please, also data.json on performance/_meta folder must be regenerated.

Thanks again!

@rameshelastic FYI 🙂

@cwuethrich
Copy link
Contributor Author

Thank you all for your support.

@sayden :

  • Is this PR changin the key of any of the output events?

No, it doesn't change anything. The counter_name is used to identify the events. object_name is different on multi instance SQL Servers. That's why the previous solution didn't work. But this field isn't used. I change the selection to a like-search. A single instance SQL Server has the same result as before.

  • How this query will behave with beats multi-instance? For me it seems it will generate duplicate data.

If I understand you right it could happen. But this is exactly the same without this change. It doesn't change anything.

Please, also data.json on performance/_meta folder must be regenerated.

This file doesn't change.

@sayden
Copy link
Contributor

sayden commented Apr 13, 2022

The CI now complains about old code. This is a way to fix some stuff incrementally. I know it's unrelated to your PR but you'll have to fix this too.

We can safely assume that you can change those errors.Wrap(err, "msg") to fmt.Errorf("msg %w", err) and remove the import.

Sorry for this extra step.

Update of _meta/data.json is mandatory in this type of PR, even if only values changes and not keys. You can just copy-paste one example event from the console by running metricbeat with -e -d "*" for example.

Everything else, I don't see any reason to not merge this after those changes.

CHANGELOG.next.asciidoc Outdated Show resolved Hide resolved
x-pack/metricbeat/module/mssql/performance/performance.go Outdated Show resolved Hide resolved
@jlind23 jlind23 requested review from a team and removed request for a team April 13, 2022 15:20
@cwuethrich
Copy link
Contributor Author

Everything else, I don't see any reason to not merge this after those changes.

@sayden thank you for your great support. Should be all fixed now.

@cwuethrich cwuethrich requested a review from sayden April 23, 2022 23:18
@sayden
Copy link
Contributor

sayden commented Apr 25, 2022

/test

@sayden
Copy link
Contributor

sayden commented Apr 25, 2022

/test

it seems something got hanged in the previous attempt and I was getting a 500 when triggering an individual step

Copy link
Contributor

@sayden sayden left a comment

Choose a reason for hiding this comment

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

LGTM Thank you!

@sayden sayden merged commit 56df883 into elastic:main Apr 25, 2022
kush-elastic pushed a commit to kush-elastic/beats that referenced this pull request May 2, 2022
@cwuethrich cwuethrich deleted the metricbeat-mssql-instance branch May 3, 2022 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

metricbeat mssql module: performance counter don't work with named instances
6 participants