Skip to content

Commit

Permalink
fix: added specVersion to Metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswk committed Jul 29, 2024
1 parent 5678649 commit f30fcdc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
deprecatedSuffix = "/features"
clientName = "unleash-client-go"
clientVersion = "4.1.1"
specVersion = "4.3.1"
)

var defaultStrategies = []strategy.Strategy{
Expand Down
8 changes: 8 additions & 0 deletions metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ type MetricsData struct {

// Optional field that describes the sdk version (name:version)
SDKVersion string `json:"sdkVersion"`

// Which version of the Unleash-Client-Spec is this SDK validated against
SpecVersion string `json:"specVersion"`
}

// ClientData represents the data sent to the unleash during registration.
Expand Down Expand Up @@ -65,6 +68,9 @@ type ClientData struct {
PlatformName string `json:"platformName"`

YggdrasilVersion *string `json:"yggdrasilVersion"`

// Which version of the Unleash-Client-Spec is this SDK validated against
SpecVersion string `json:"specVersion"`
}

type metric struct {
Expand Down Expand Up @@ -204,6 +210,7 @@ func (m *metrics) sendMetrics() {
PlatformName: "go",
PlatformVersion: runtime.Version(),
YggdrasilVersion: nil,
SpecVersion: specVersion,
}

u, _ := m.options.url.Parse("./client/metrics")
Expand Down Expand Up @@ -335,5 +342,6 @@ func (m *metrics) getClientData() ClientData {
runtime.Version(),
"go",
nil,
specVersion,
}
}
1 change: 1 addition & 0 deletions metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ func TestMetrics_ClientDataIncludesNewMetadata(t *testing.T) {
PlatformVersion: runtime.Version(),
PlatformName: "go",
YggdrasilVersion: nil,
SpecVersion: specVersion,
}).
Reply(200)
client, err := NewClient(
Expand Down

0 comments on commit f30fcdc

Please sign in to comment.