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

mssql datasource #307

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

mssql datasource #307

wants to merge 5 commits into from

Conversation

ImNtReal
Copy link

SUMMARY

Added support for mssql as a datasource. It might be possible to better support some options, but this is working for me.

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

grafana_datasource

ADDITIONAL INFORMATION

I'm not really sure what to add. I'm using this to add Microsoft SQL Server datasources to Grafana for a tool called SQLWATCH.

ok: [vmdbtest01] => {
    "datasource": {
        "changed": true,
        "datasource": {
            "access": "proxy",
            "basicAuth": false,
            "basicAuthUser": "",
            "database": "SQLWATCH",
            "id": 2,
            "isDefault": false,
            "jsonData": {
                "timeInterval": "5s",
                "tlsAuth": false,
                "tlsAuthWithCACert": false
            },
            "name": "vmdbtest01 SQLWATCH",
            "orgId": 1,
            "readOnly": false,
            "secureJsonFields": {
                "password": true
            },
            "type": "mssql",
            "typeLogoUrl": "",
            "uid": "xxxxx",
            "url": "vmdbtest01.company.com",
            "user": "sqlwatch",
            "version": 1,
            "withCredentials": false
        },
        "diff": {
            "after": {
                "access": "proxy",
                "basicAuth": false,
                "database": "SQLWATCH",
                "isDefault": false,
                "jsonData": {
                    "timeInterval": "5s",
                    "tlsAuth": false,
                    "tlsAuthWithCACert": false
                },
                "name": "vmdbtest01 SQLWATCH",
                "orgId": 1,
                "type": "mssql",
                "url": "vmdbtest01.company.com",
                "user": "sqlwatch",
                "withCredentials": false
            },
            "before": {
                "access": "proxy",
                "basicAuth": false,
                "database": "",
                "isDefault": false,
                "jsonData": {
                    "authenticationType": "Windows Authentication",
                    "connMaxLifetime": 14400,
                    "database": "SQLWATCH",
                    "maxIdleConns": 100,
                    "maxIdleConnsAuto": true,
                    "maxOpenConns": 100,
                    "timeInterval": "5s",
                    "tlsAuth": false,
                    "tlsAuthWithCACert": false
                },
                "name": "vmdbtest01 SQLWATCH",
                "orgId": 1,
                "type": "mssql",
                "url": "vmdbtest01.company.com",
                "user": "",
                "withCredentials": false
            }
        },
        "failed": false,
        "msg": "Datasource vmdbtest01 SQLWATCH updated"
    }
}

@ImNtReal ImNtReal requested review from rrey and seuf as code owners June 28, 2023 17:04
@ImNtReal
Copy link
Author

Just realized I have a typeo in my first commit. There's not a way to fix it here without opening a new PR, is there?

@seuf
Copy link
Collaborator

seuf commented Oct 23, 2023

Hello @ImNtReal . Thanks for your MR, you can do a git rebase origin main and squash the 2nt commit, then git push your branch --force.

Also, can you add a changelog fragment please ?

Copy link
Collaborator

@seuf seuf left a comment

Choose a reason for hiding this comment

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

Changelog fragment missing

@ImNtReal
Copy link
Author

ImNtReal commented Nov 9, 2023

@seuf sorry it took me so long to get back around to this. I've added a changelog fragment.

Copy link

codecov bot commented Nov 10, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ff49e95) 69.63% compared to head (8e1ab84) 71.06%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #307      +/-   ##
==========================================
+ Coverage   69.63%   71.06%   +1.42%     
==========================================
  Files           9       18       +9     
  Lines        1166     1863     +697     
  Branches      255      321      +66     
==========================================
+ Hits          812     1324     +512     
- Misses        204      397     +193     
+ Partials      150      142       -8     
Flag Coverage Δ
integration 69.81% <100.00%> (+0.17%) ⬆️
sanity 23.70% <0.00%> (?)
units 65.59% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
plugins/modules/grafana_datasource.py 76.71% <100.00%> (+2.64%) ⬆️

... and 16 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rndmh3ro
Copy link
Collaborator

Hey @ImNtReal,

would you mind creating some integration-tests for this PR? :)

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.

3 participants