Skip to content

Commit

Permalink
Expose the concurrent query count key in sdk (#875)
Browse files Browse the repository at this point in the history
* Expose the concurrent query count key in sdk

* Update backend/config.go

Co-authored-by: Andres Martinez Gotor <[email protected]>

---------

Co-authored-by: Andres Martinez Gotor <[email protected]>
  • Loading branch information
itsmylife and andresmgot authored Jan 29, 2024
1 parent d8f8ae6 commit 60cd92b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion backend/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
)

const (
AppURL = "GF_APP_URL"
AppURL = "GF_APP_URL"
ConcurrentQueryCount = "GF_CONCURRENT_QUERY_COUNT"
)

type configKey struct{}
Expand Down Expand Up @@ -138,6 +139,18 @@ func (c *GrafanaCfg) AppURL() (string, error) {
return url, nil
}

func (c *GrafanaCfg) ConcurrentQueryCount() (int, error) {
count, ok := c.config[ConcurrentQueryCount]
if !ok {
return 0, fmt.Errorf("ConcurrentQueryCount not set in config")
}
i, err := strconv.Atoi(count)
if err != nil {
return 0, fmt.Errorf("ConcurrentQueryCount cannot be converted to integer")
}
return i, nil
}

type userAgentKey struct{}

// UserAgentFromContext returns user agent from context.
Expand Down

0 comments on commit 60cd92b

Please sign in to comment.