Skip to content

Commit 60cd92b

Browse files
Expose the concurrent query count key in sdk (#875)
* 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]>
1 parent d8f8ae6 commit 60cd92b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

backend/config.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import (
1212
)
1313

1414
const (
15-
AppURL = "GF_APP_URL"
15+
AppURL = "GF_APP_URL"
16+
ConcurrentQueryCount = "GF_CONCURRENT_QUERY_COUNT"
1617
)
1718

1819
type configKey struct{}
@@ -138,6 +139,18 @@ func (c *GrafanaCfg) AppURL() (string, error) {
138139
return url, nil
139140
}
140141

142+
func (c *GrafanaCfg) ConcurrentQueryCount() (int, error) {
143+
count, ok := c.config[ConcurrentQueryCount]
144+
if !ok {
145+
return 0, fmt.Errorf("ConcurrentQueryCount not set in config")
146+
}
147+
i, err := strconv.Atoi(count)
148+
if err != nil {
149+
return 0, fmt.Errorf("ConcurrentQueryCount cannot be converted to integer")
150+
}
151+
return i, nil
152+
}
153+
141154
type userAgentKey struct{}
142155

143156
// UserAgentFromContext returns user agent from context.

0 commit comments

Comments
 (0)