Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure visibility metrics #1073

Open
wants to merge 23 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"`
}
Loading