Skip to content

Commit

Permalink
feat: set build version on upstream clients
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed May 25, 2024
1 parent 3e55225 commit 1cfe1af
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"os"
"strconv"

"github.com/flanksource/commons/http"

"github.com/flanksource/commons/logger"
"github.com/flanksource/config-db/api"
"github.com/flanksource/config-db/db"
Expand Down Expand Up @@ -67,6 +69,15 @@ var Root = &cobra.Command{
db.Schema = readFromEnv(db.Schema)
db.PGRSTLogLevel = readFromEnv(db.PGRSTLogLevel)

if api.UpstreamConfig.Valid() {
api.UpstreamConfig.Options = append(api.UpstreamConfig.Options, func(c *http.Client) {
c.UserAgent(fmt.Sprintf("config-db %s", version))
})
logger.Infof("pushing configs to %s", api.UpstreamConfig)
} else if partial, err := api.UpstreamConfig.IsPartiallyFilled(); partial && err != nil {
logger.Warnf("upstream is not fully configured: %s", api.UpstreamConfig)
}

if otelcollectorURL != "" {
logger.Infof("Sending traces to %s", otelcollectorURL)
_ = telemetry.InitTracer(otelServiceName, otelcollectorURL, true) // TODO: Setup runner
Expand Down

0 comments on commit 1cfe1af

Please sign in to comment.