Skip to content

Commit

Permalink
fix: filter repoMetadata from telemetry (infracost#2020)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugorut authored Sep 6, 2022
1 parent 45e6d06 commit 2a53209
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion internal/apiclient/pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import (
"github.com/tidwall/gjson"
)

var (
excludedEnv = map[string]struct{}{
"repoMetadata": {},
}
)

type PricingAPIClient struct {
APIClient
Currency string
Expand Down Expand Up @@ -80,9 +86,18 @@ func (c *PricingAPIClient) AddEvent(name string, env map[string]interface{}) err
return nil
}

filtered := make(map[string]interface{})
for k, v := range env {
if _, ok := excludedEnv[k]; ok {
continue
}

filtered[k] = v
}

d := map[string]interface{}{
"event": name,
"env": env,
"env": filtered,
}

_, err := c.doRequest("POST", "/event", d)
Expand Down

0 comments on commit 2a53209

Please sign in to comment.