aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/metrics/counters.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/metrics/counters.go')
-rw-r--r--pkg/metrics/counters.go53
1 files changed, 52 insertions, 1 deletions
diff --git a/pkg/metrics/counters.go b/pkg/metrics/counters.go
index 2fc9539..bbf148b 100644
--- a/pkg/metrics/counters.go
+++ b/pkg/metrics/counters.go
@@ -1,12 +1,33 @@
+// -
+// ========================LICENSE_START=================================
+// Copyright (C) 2024: Deutsche Telekom
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// SPDX-License-Identifier: Apache-2.0
+// ========================LICENSE_END===================================
+//
+
package metrics
import "sync"
-//global counter variables
+// global counter variables
var IndeterminantDecisionsCount int64
var PermitDecisionsCount int64
var DenyDecisionsCount int64
var TotalErrorCount int64
+var QuerySuccessCount int64
+var QueryFailureCount int64
var mu sync.Mutex
// Increment counter
@@ -64,3 +85,33 @@ func TotalErrorCountRef() *int64 {
defer mu.Unlock()
return &TotalErrorCount
}
+
+// Increment counter
+func IncrementQuerySuccessCount() {
+ mu.Lock()
+ QuerySuccessCount++
+ mu.Unlock()
+}
+
+// returns pointer to the counter
+func TotalQuerySuccessCountRef() *int64 {
+ mu.Lock()
+ defer mu.Unlock()
+ return &QuerySuccessCount
+
+}
+
+// Increment counter
+func IncrementQueryFailureCount() {
+ mu.Lock()
+ QueryFailureCount++
+ mu.Unlock()
+}
+
+// returns pointer to the counter
+func TotalQueryFailureCountRef() *int64 {
+ mu.Lock()
+ defer mu.Unlock()
+ return &QueryFailureCount
+
+}