Using the EncodeToString function from the encoding/hex package
is much faster than calling the fmt.Sprintf with %x
Benchmark results below with the following code
func BenchmarkHexPrint(b *testing.B) {
data := []byte("hellothere")
for n := 0; n < b.N; n++ {
// _ = fmt.Sprintf("%x", data)
_ = hex.EncodeToString(data)
}
}
name old time/op new time/op delta
HexPrint-4 188ns ± 1% 99ns ± 1% -47.40% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
HexPrint-4 64.0B ± 0% 64.0B ± 0% ~ (all equal)
name old allocs/op new allocs/op delta
HexPrint-4 2.00 ± 0% 2.00 ± 0% ~ (all equal)
Set MaxIdleConn and MaxOpenConn when using the GF_DATABASE_URL configuration. Also added GF_DATABASE_DEBUG flag to print SQL statements and SQL execution times.
See #9784 for the details.
* add __timeGroup macro for mysql
* put example __timeGroup query in frontend help
* do __timeGroup interval parsing in go similar to mysql
* ignore whitespace around interval
* modify $__timeGroup macro so it can be used in select clause
* fix $__interval_ms for postgres datasource
* use $__timeGroup macro in documentation
* fix annotation template query
remove title since its no longer used and add tags instead
* change __timeFilter macro to work on postgresql < 8.1 and redshift
* annotations: throw error if no text specified and set default time to Now() if empty, #9571
* annotations: fix saving graphite event with empty string tags
* docs: add /api/annotations/graphite endpoint docs, #9571
Prometheus client lib support gzip by itself. Which caused the
response to be double gzipped sometimes. We should use the Grafana
middle ware instead.
closes#9464
* annotations: add endpoint for writing graphite-like events
* annotations: fix new line handling in tooltip
* annotations: support tags in prior to Graphite 0.10.0 format
I renamed `tlsAuth` to `tlsClientAuth` to better describe the fact that
this variable is used to enable TLS client authentication (as opposed to
server authentication) in c04d95f35.
However, changing the name breaks backwards compatibility for existing
installations using this feature and Grafana does not have a
standardised way of migrating changes in the schema:
https://github.com/grafana/grafana/pull/9377#issuecomment-333063543
For reasons of expediency given the severity of the bug (not verifying
TLS), keep the old name.
In c04d95f35 I changed the default for datasource HTTP requests so that
TLS is always verified.
This commit adds a checkbox to allow an admin to explicitly skip TLS
verification, for testing purposes.