Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@itsmylife
Copy link
Contributor

@itsmylife itsmylife commented Jan 27, 2023

What is this feature?
Since the database field in DataSourceInstanceSettings is deprecated we have to move that information in to the jsonData.
Newly created InfluxDB v1.x datasources will have dbName field in jsonData to store database information.
Existing datasources will not be affected and will keep working. If the user updates the datasource configuration (changes the database name) new data will be written in jsonData.

Also, test data for local development is updated and they do not have database field but jsonData.dbName.

Why do we need this feature?

database field in DataSourceInstanceSettings is deprecated. https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/types/datasource.ts#L583-L587
We should move that information into the jsonData.

Who is this feature for?

People who use InfluxDB v1.x

Which issue(s) does this PR fix?:

Fixes #59115

Special notes for your reviewer:

How to test

  • Create an influxdb v1.x datasource/dashboard or use an existing one.
  • Switch to this branch and see datasource and queries and dashboards are working.

Disclaimer

  • A broader deprecation and backward compatibility I will have another task. This won't be easy and we should be careful about that.

@itsmylife itsmylife requested a review from gabor January 27, 2023 12:12
@itsmylife itsmylife requested review from a team as code owners January 27, 2023 12:12
@itsmylife itsmylife requested review from idafurjes, sakjur and ying-jeanne and removed request for a team January 27, 2023 12:12
@itsmylife itsmylife added this to the 9.4.0 milestone Jan 27, 2023
Token string
URL string

Database string `json:"database"`
Copy link
Contributor

@gabor gabor Jan 27, 2023

Choose a reason for hiding this comment

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

strange.. so, there already was code to read jsonData.database, but the value was never used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In influxdb.go line 181 it is being used params.Set("db", dsInfo.Database)

Copy link
Contributor

Choose a reason for hiding this comment

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

i see, sorry, i got confuse because the same models.DatasourceInfo structure is created two times in newInstanceSetting.

Copy link
Contributor

@gabor gabor left a comment

Choose a reason for hiding this comment

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

the code looks good 👍 , i have left one idea how to improve it. i have not tested it though. i recommend watching sqlite3 data/grafana.db during the tests to see the right fields get the right values.

Copy link
Contributor

@gabor gabor left a comment

Choose a reason for hiding this comment

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

LGTM!

@itsmylife itsmylife merged commit 65fbbc0 into main Jan 31, 2023
@itsmylife itsmylife deleted the ismail/influxdb-move-database-into-jsondata branch January 31, 2023 13:38
@itsmylife itsmylife modified the milestones: 9.4.0, 9.5.0 Mar 13, 2023
@itsmylife itsmylife added breaking change Relevant for changelog generation and removed breaking change Relevant for changelog generation labels Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Influxdb: Deprecate database field and move to jsonData

3 participants