Skip to content

Commit 10bbbc8

Browse files
authored
Added product_id field to the visibility metric (#1317)
1 parent 556265c commit 10bbbc8

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ require (
9696
gopkg.in/warnings.v0 v0.1.2 // indirect
9797
)
9898

99-
// replace github.com/jfrog/jfrog-client-go => github.com/eyalbe4/jfrog-client-go v1.28.1-0.20241222155750-04d75d451f23
99+
replace github.com/jfrog/jfrog-client-go => github.com/eyalbe4/jfrog-client-go v1.28.1-0.20241223165051-2717483395bc
100100

101101
// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20241121100855-e7a75ceee2bd
102102

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcej
5151
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
5252
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
5353
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
54+
github.com/eyalbe4/jfrog-client-go v1.28.1-0.20241223165051-2717483395bc h1:VLvI2P75Fc8iJVrydKEMcmeBCcKeUHmB7lLEm5P8aYU=
55+
github.com/eyalbe4/jfrog-client-go v1.28.1-0.20241223165051-2717483395bc/go.mod h1:2ySOMva54L3EYYIlCBYBTcTgqfrrQ19gtpA/MWfA/ec=
5456
github.com/forPelevin/gomoji v1.2.0 h1:9k4WVSSkE1ARO/BWywxgEUBvR/jMnao6EZzrql5nxJ8=
5557
github.com/forPelevin/gomoji v1.2.0/go.mod h1:8+Z3KNGkdslmeGZBC3tCrwMrcPy5GRzAD+gL9NAwMXg=
5658
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
@@ -93,8 +95,6 @@ github.com/jfrog/build-info-go v1.10.7 h1:10NVHYg0193gJpQft+S4WQfvYMtj5jlwwhJRvk
9395
github.com/jfrog/build-info-go v1.10.7/go.mod h1:JcISnovFXKx3wWf3p1fcMmlPdt6adxScXvoJN4WXqIE=
9496
github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s=
9597
github.com/jfrog/gofrog v1.7.6/go.mod h1:ntr1txqNOZtHplmaNd7rS4f8jpA5Apx8em70oYEe7+4=
96-
github.com/jfrog/jfrog-client-go v1.48.5 h1:q8v8oZ2HwwVw6+ZCwKbuIpUmxpWUeZzvTASQl/QKxKw=
97-
github.com/jfrog/jfrog-client-go v1.48.5/go.mod h1:2ySOMva54L3EYYIlCBYBTcTgqfrrQ19gtpA/MWfA/ec=
9898
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
9999
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
100100
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=

utils/usage/visibility_system_manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func NewVisibilitySystemManager(serverDetails *config.ServerDetails) *Visibility
2222
func (vsm *VisibilitySystemManager) createMetric(commandName string) services.VisibilityMetric {
2323
metricLabels := services.Labels{
2424
ProductID: coreutils.GetCliUserAgentName(),
25+
ProductVersion: coreutils.GetCliUserAgentVersion(),
2526
FeatureID: commandName,
2627
OIDCUsed: os.Getenv("JFROG_CLI_USAGE_OIDC_USED"),
2728
JobID: os.Getenv("JFROG_CLI_USAGE_JOB_ID"),

utils/usage/visibility_system_manager_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import (
1212
func TestCreateMetric(t *testing.T) {
1313
// Set environment variables for the test using SetEnvWithCallbackAndAssert
1414
envVars := map[string]string{
15-
"JFROG_CLI_USAGE_OIDC_USED": "true",
15+
"JFROG_CLI_USAGE_OIDC_USED": "TRUE",
1616
"JFROG_CLI_USAGE_JOB_ID": "job123",
1717
"JFROG_CLI_USAGE_RUN_ID": "run456",
1818
"JFROG_CLI_USAGE_GIT_REPO": "test-repo",
19-
"JFROG_CLI_USAGE_GH_TOKEN_FOR_CODE_SCANNING_ALERTS_PROVIDED": "true",
19+
"JFROG_CLI_USAGE_GH_TOKEN_FOR_CODE_SCANNING_ALERTS_PROVIDED": "TRUE",
2020
}
2121
cleanupFuncs := []func(){}
2222
for key, value := range envVars {
@@ -40,12 +40,13 @@ func TestCreateMetric(t *testing.T) {
4040
"metrics_name": "jfcli_commands_count",
4141
"labels": {
4242
"product_id": "` + coreutils.GetCliUserAgentName() + `",
43+
"product_version": "` + coreutils.GetCliUserAgentVersion() + `",
4344
"feature_id": "testCommand",
44-
"oidc_used": "true",
45+
"oidc_used": "TRUE",
4546
"job_id": "job123",
4647
"run_id": "run456",
4748
"git_repo": "test-repo",
48-
"gh_token_for_code_scanning_alerts_provided": "true"
49+
"gh_token_for_code_scanning_alerts_provided": "TRUE"
4950
}
5051
}`
5152

0 commit comments

Comments
 (0)