Skip to content

Commit

Permalink
fix: correct lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Oct 22, 2024
1 parent fb65ccb commit 629ce81
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
4 changes: 4 additions & 0 deletions internal/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/golang-jwt/jwt/v5"
"github.com/snapp-incubator/soteria/internal/api"
"github.com/snapp-incubator/soteria/internal/authenticator"
"github.com/snapp-incubator/soteria/internal/clientid"
"github.com/snapp-incubator/soteria/internal/config"
"github.com/stretchr/testify/suite"
"go.opentelemetry.io/otel/trace/noop"
Expand Down Expand Up @@ -137,6 +138,9 @@ func (suite *APITestSuite) SetupSuite() {
DefaultVendor: "snapp",
Tracer: noop.NewTracerProvider().Tracer(""),
Logger: zap.NewExample(),
Parser: clientid.NewParser(clientid.Config{
Patterns: map[string]string{},
}),
}

app.Post("/v2/auth", a.Authv2)
Expand Down
26 changes: 14 additions & 12 deletions internal/authenticator/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ import (
)

// nolint:exhaustruct,gochecknoglobals
var AuthenticateCounterMetric = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "dispatching",
Subsystem: "soteria",
Name: "auth_total",
Help: "Total number of authentication attempts",
}, []string{"company", "status", "source"})
var (
AuthenticateCounterMetric = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "dispatching",
Subsystem: "soteria",
Name: "auth_total",
Help: "Total number of authentication attempts",
}, []string{"company", "status", "source"})

var AuthorizeCounterMetric = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "dispatching",
Subsystem: "soteria",
Name: "acl_total",
Help: "Total number of authorization attempts",
}, []string{"company", "status"})
AuthorizeCounterMetric = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "dispatching",
Subsystem: "soteria",
Name: "acl_total",
Help: "Total number of authorization attempts",
}, []string{"company", "status"})
)

func IncrementAuthCounter(company, source string) {
AuthenticateCounterMetric.WithLabelValues(company, "success", source).Inc()
Expand Down

0 comments on commit 629ce81

Please sign in to comment.