Skip to content

Commit

Permalink
Merge branch 'main' into adhoc-numeric-varchar-field
Browse files Browse the repository at this point in the history
  • Loading branch information
afagundes authored Dec 11, 2023
2 parents af647da + a919fd2 commit 0bac4d2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
node-version-file: '.nvmrc'

- name: Install Go environment
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 'stable'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-backend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4.1.0
uses: actions/setup-go@v5
with:
go-version: 'stable'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
node-version-file: '.nvmrc'

- name: Install Go
uses: actions/setup-go@v4.1.0
uses: actions/setup-go@v5
with:
go-version: 'stable'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-k6e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4.1.0
uses: actions/setup-go@v5
with:
go-version: 'stable'

Expand Down
17 changes: 9 additions & 8 deletions pkg/plugin/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"encoding/json"
"fmt"
"net"
"os"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -56,8 +55,10 @@ func getTLSConfig(settings Settings) (*tls.Config, error) {
return tlsConfig, nil
}

func getClientInfoProducts() (products []struct{ Name, Version string }) {
if version := os.Getenv("GF_VERSION"); version != "" {
func getClientInfoProducts(ctx context.Context) (products []struct{ Name, Version string }) {
version := backend.UserAgentFromContext(ctx).GrafanaVersion()

if version != "" {
products = append(products, struct{ Name, Version string }{
Name: "grafana",
Version: version,
Expand Down Expand Up @@ -140,9 +141,13 @@ func (h *Clickhouse) Connect(config backend.DataSourceInstanceSettings, message
}
}

timeout := time.Duration(t)
ctx, cancel := context.WithTimeout(context.Background(), timeout*time.Second)
defer cancel()

opts := &clickhouse.Options{
ClientInfo: clickhouse.ClientInfo{
Products: getClientInfoProducts(),
Products: getClientInfoProducts(ctx),
},
TLS: tlsConfig,
Addr: []string{fmt.Sprintf("%s:%d", settings.Server, settings.Port)},
Expand Down Expand Up @@ -179,10 +184,6 @@ func (h *Clickhouse) Connect(config backend.DataSourceInstanceSettings, message

db := clickhouse.OpenDB(opts)

timeout := time.Duration(t)
ctx, cancel := context.WithTimeout(context.Background(), timeout*time.Second)
defer cancel()

chErr := make(chan error, 1)
go func() {
err = db.PingContext(ctx)
Expand Down

0 comments on commit 0bac4d2

Please sign in to comment.