-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Visibility - update commands count metric to correspond with client c…
…hanges (#1330)
- Loading branch information
Showing
7 changed files
with
70 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package visibility | ||
|
||
import ( | ||
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" | ||
"github.com/jfrog/jfrog-client-go/jfconnect/services" | ||
"os" | ||
) | ||
|
||
type commandsCountLabels struct { | ||
ProductID string `json:"product_id"` | ||
ProductVersion string `json:"product_version"` | ||
FeatureID string `json:"feature_id"` | ||
OIDCUsed string `json:"oidc_used"` | ||
JobID string `json:"job_id"` | ||
RunID string `json:"run_id"` | ||
GitRepo string `json:"git_repo"` | ||
GhTokenForCodeScanningAlertsProvided string `json:"gh_token_for_code_scanning_alerts_provided"` | ||
} | ||
|
||
func NewCommandsCountMetric(commandName string) services.VisibilityMetric { | ||
return services.VisibilityMetric{ | ||
Value: 1, | ||
Name: "jfcli_commands_count", | ||
Labels: &commandsCountLabels{ | ||
ProductID: coreutils.GetCliUserAgentName(), | ||
ProductVersion: coreutils.GetCliUserAgentVersion(), | ||
FeatureID: commandName, | ||
OIDCUsed: os.Getenv("JFROG_CLI_USAGE_OIDC_USED"), | ||
JobID: os.Getenv("JFROG_CLI_USAGE_JOB_ID"), | ||
RunID: os.Getenv("JFROG_CLI_USAGE_RUN_ID"), | ||
GitRepo: os.Getenv("JFROG_CLI_USAGE_GIT_REPO"), | ||
GhTokenForCodeScanningAlertsProvided: os.Getenv("JFROG_CLI_USAGE_GH_TOKEN_FOR_CODE_SCANNING_ALERTS_PROVIDED"), | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package visibility | ||
|
||
import ( | ||
"github.com/jfrog/jfrog-cli-core/v2/artifactory/utils" | ||
"github.com/jfrog/jfrog-cli-core/v2/utils/config" | ||
"github.com/jfrog/jfrog-client-go/jfconnect/services" | ||
) | ||
|
||
type VisibilitySystemManager struct { | ||
serverDetails *config.ServerDetails | ||
} | ||
|
||
func NewVisibilitySystemManager(serverDetails *config.ServerDetails) *VisibilitySystemManager { | ||
return &VisibilitySystemManager{ | ||
serverDetails: serverDetails, | ||
} | ||
} | ||
|
||
func (vsm *VisibilitySystemManager) SendUsage(metric services.VisibilityMetric) error { | ||
manager, err := utils.CreateJfConnectServiceManager(vsm.serverDetails, 0, 0) | ||
if err != nil { | ||
return err | ||
} | ||
return manager.PostVisibilityMetric(metric) | ||
} |
This file was deleted.
Oops, something went wrong.