Skip to content

Commit

Permalink
Restructure visibility metrics (jfrog#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
omerzi authored Jan 21, 2025
1 parent 32f2fc1 commit a3e981c
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions jfconnect/services/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@ package services

import (
"encoding/json"
"net/http"

"github.com/jfrog/jfrog-client-go/auth"
"github.com/jfrog/jfrog-client-go/http/jfroghttpclient"
clientutils "github.com/jfrog/jfrog-client-go/utils"
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"net/http"
)

const LogMetricApiEndpoint = "api/v1/backoffice/metrics/log"

type VisibilityMetric struct {
Value int `json:"value"`
Name string `json:"metrics_name"`
Labels any `json:"labels"`
}

type JfConnectService struct {
client *jfroghttpclient.JfrogHttpClient
serviceDetails *auth.ServiceDetails
Expand Down Expand Up @@ -42,20 +47,3 @@ func (jcs *JfConnectService) PostVisibilityMetric(metric VisibilityMetric) error
}
return errorutils.CheckResponseStatusWithBody(resp, body, http.StatusCreated, http.StatusOK)
}

type Labels 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"`
}

type VisibilityMetric struct {
Value int `json:"value"`
MetricsName string `json:"metrics_name"`
Labels Labels `json:"labels"`
}

0 comments on commit a3e981c

Please sign in to comment.