mirror of
https://github.com/grafana/grafana.git
synced 2025-01-24 15:27:01 -06:00
MySQL Datasource: Add timezone parameter (#27535)
* Add MySQL timezone parameter * Reword docs/sources/features/datasources/mysql.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * update documentation * fix formatting mistake from merge * enhance documentation with reason for parameter usage * enhance documentation with reason for parameter usage Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
This commit is contained in:
parent
3a68409e5d
commit
29be741f26
@ -22,13 +22,14 @@ Grafana ships with a built-in MySQL data source plugin that allows you to query
|
|||||||
### Data source options
|
### Data source options
|
||||||
|
|
||||||
Name | Description
|
Name | Description
|
||||||
-------------- | -------------
|
------------------ | -------------
|
||||||
`Name` | The data source name. This is how you refer to the data source in panels and queries.
|
`Name` | The data source name. This is how you refer to the data source in panels and queries.
|
||||||
`Default` | Default data source means that it will be pre-selected for new panels.
|
`Default` | Default data source means that it will be pre-selected for new panels.
|
||||||
`Host` | The IP address/hostname and optional port of your MySQL instance.
|
`Host` | The IP address/hostname and optional port of your MySQL instance.
|
||||||
`Database` | Name of your MySQL database.
|
`Database` | Name of your MySQL database.
|
||||||
`User` | Database user's login/username
|
`User` | Database user's login/username
|
||||||
`Password` | Database user's password
|
`Password` | Database user's password
|
||||||
|
`Session Timezone` | Specify the time zone used in the database session, such as `Europe/Berlin` or `+02:00`. This is necessary, if the timezone of the database (or the host of the database) is set to something other than UTC. Set the value used in the session with `SET time_zone='...'`. If you leave this field empty, then the time zone is not updated. For more information, refer to the [MySQL documentation](https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html).
|
||||||
`Max open` | The maximum number of open connections to the database, default `unlimited` (Grafana v5.4+).
|
`Max open` | The maximum number of open connections to the database, default `unlimited` (Grafana v5.4+).
|
||||||
`Max idle` | The maximum number of connections in the idle connection pool, default `2` (Grafana v5.4+).
|
`Max idle` | The maximum number of connections in the idle connection pool, default `2` (Grafana v5.4+).
|
||||||
`Max lifetime` | The maximum amount of time in seconds a connection may be reused, default `14400`/4 hours. This should always be lower than configured [wait_timeout](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) in MySQL (Grafana v5.4+).
|
`Max lifetime` | The maximum amount of time in seconds a connection may be reused, default `14400`/4 hours. This should always be lower than configured [wait_timeout](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) in MySQL (Grafana v5.4+).
|
||||||
|
@ -64,6 +64,13 @@ func New(httpClientProvider httpclient.Provider) func(datasource *models.DataSou
|
|||||||
cnnstr += "&tls=" + tlsConfigString
|
cnnstr += "&tls=" + tlsConfigString
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if datasource.JsonData != nil {
|
||||||
|
timezone, hasTimezone := datasource.JsonData.CheckGet("timezone")
|
||||||
|
if hasTimezone && timezone.MustString() != "" {
|
||||||
|
cnnstr += fmt.Sprintf("&time_zone='%s'", url.QueryEscape(timezone.MustString()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if setting.Env == setting.Dev {
|
if setting.Env == setting.Dev {
|
||||||
logger.Debug("getEngine", "connection", cnnstr)
|
logger.Debug("getEngine", "connection", cnnstr)
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="gf-form max-width-30">
|
||||||
|
<span class="gf-form-label width-10">Session Timezone</span>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="gf-form-input gf-form-input--has-help-icon"
|
||||||
|
ng-model="ctrl.current.jsonData.timezone"
|
||||||
|
spellcheck='false'
|
||||||
|
placeholder="(default)"
|
||||||
|
></input>
|
||||||
|
<info-popover mode="right-absolute">
|
||||||
|
Specify the time zone used in the database session, e.g. <code>Europe/Berlin</code> or <code>+02:00</code>.
|
||||||
|
This is necessary, if the timezone of the database (or the host of the database) is set to something other than UTC.
|
||||||
|
The value is set in the session with <code>SET time_zone='...'</code>. If you leave this field empty,
|
||||||
|
the timezone is not updated. You can find more information in the
|
||||||
|
<a href="https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html">MySQL documentation</a>.
|
||||||
|
</info-popover>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="gf-form-group">
|
<div class="gf-form-group">
|
||||||
<div class="gf-form-inline">
|
<div class="gf-form-inline">
|
||||||
<gf-form-checkbox class="gf-form" label="TLS Client Auth" label-class="width-10"
|
<gf-form-checkbox class="gf-form" label="TLS Client Auth" label-class="width-10"
|
||||||
|
Loading…
Reference in New Issue
Block a user