Skip to content

Commit

Permalink
Merge pull request #385 from mergenci/external-api-calls-metric
Browse files Browse the repository at this point in the history
Add external API calls metric
  • Loading branch information
mergenci authored Mar 28, 2024
2 parents 50919fe + 5f977ad commit 4c67d8e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ var (
Buckets: []float64{1, 5, 10, 15, 30, 60, 120, 300, 600, 1800, 3600},
}, []string{"operation"})

// ExternalAPICalls is a counter metric of the number of external
// API calls. "service" and "operation" labels could be used to
// classify calls into a two-level hierarchy, in which calls are
// "operations" that belong to a "service". Users should beware of
// performance implications of high cardinality that could occur
// when there are many services and operations. See:
// https://prometheus.io/docs/practices/naming/#labels
ExternalAPICalls = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: promNSUpjet,
Subsystem: promSysResource,
Name: "external_api_calls_total",
Help: "The number of external API calls.",
}, []string{"service", "operation"})

// DeletionTime is the histogram metric for collecting statistics on the
// intervals between the deletion timestamp and the moment when
// the resource is observed to be missing (actually deleted).
Expand Down Expand Up @@ -174,5 +188,5 @@ func (r *MetricRecorder) Start(ctx context.Context) error {
}

func init() {
metrics.Registry.MustRegister(CLITime, CLIExecutions, TFProcesses, TTRMeasurements, ExternalAPITime, DeletionTime, ReconcileDelay)
metrics.Registry.MustRegister(CLITime, CLIExecutions, TFProcesses, TTRMeasurements, ExternalAPITime, ExternalAPICalls, DeletionTime, ReconcileDelay)
}

0 comments on commit 4c67d8e

Please sign in to comment.