Merge remote-tracking branch 'grafana/master' into proxy-slash

* grafana/master: (127 commits)
  alerting: move all notification conditions to defaultShouldNotify
  filter NULL values for column value suggestions
  imguploader: Add support for ECS credential provider for S3
  Remove .dropdown-menu-open on body click fixes #13409
  Remove option r from ln command since its not working everywhere
  fix: updated tests
  Fix spelling of your and you're
  Changed setting to be an alerting setting
  Remove non-existing css prop
  fix: Legend to the right, as table, should follow the width prop. Removing css conflicting with baron's width calculation. #13312
  rendering: Added concurrent rendering limits
  devenv: fix uid for bulk alert dashboards
  Explore: moved code to app/features/explore
  target gfdev-prometheus datasource
  devenv: adds script for creating many dashboards with alerts
  Fix goconst issues
  When stacking graphs, always include the y-offset so that tooltips can render proper values for individual points
  provisioning: changed provisioning default update interval from 3 to 10 seconds
  Fix https://github.com/grafana/grafana/issues/13387 metric segment options displays after blur
  docs: improve oauth generic azure ad instructions
  ...
This commit is contained in:
ryan
2018-09-26 20:24:08 -07:00
387 changed files with 7179 additions and 5734 deletions

View File

@ -13,19 +13,20 @@ import (
const HeaderNameNoBackendCache = "X-Grafana-NoCache"
func (hs *HTTPServer) getDatasourceByID(id int64, orgID int64, nocache bool) (*m.DataSource, error) {
func (hs *HTTPServer) getDatasourceFromCache(id int64, c *m.ReqContext) (*m.DataSource, error) {
nocache := c.Req.Header.Get(HeaderNameNoBackendCache) == "true"
cacheKey := fmt.Sprintf("ds-%d", id)
if !nocache {
if cached, found := hs.cache.Get(cacheKey); found {
ds := cached.(*m.DataSource)
if ds.OrgId == orgID {
if ds.OrgId == c.OrgId {
return ds, nil
}
}
}
query := m.GetDataSourceByIdQuery{Id: id, OrgId: orgID}
query := m.GetDataSourceByIdQuery{Id: id, OrgId: c.OrgId}
if err := bus.Dispatch(&query); err != nil {
return nil, err
}
@ -37,10 +38,7 @@ func (hs *HTTPServer) getDatasourceByID(id int64, orgID int64, nocache bool) (*m
func (hs *HTTPServer) ProxyDataSourceRequest(c *m.ReqContext) {
c.TimeRequest(metrics.M_DataSource_ProxyReq_Timer)
nocache := c.Req.Header.Get(HeaderNameNoBackendCache) == "true"
ds, err := hs.getDatasourceByID(c.ParamsInt64(":id"), c.OrgId, nocache)
ds, err := hs.getDatasourceFromCache(c.ParamsInt64(":id"), c)
if err != nil {
c.JsonApiErr(500, "Unable to load datasource meta data", err)
return