@@ -54,8 +54,8 @@ type MonitoringCollector struct {
54
54
collectorFillMissingLabels bool
55
55
monitoringDropDelegatedProjects bool
56
56
logger log.Logger
57
- deltaCounterStore DeltaCounterStore
58
- deltaDistributionStore DeltaDistributionStore
57
+ counterStore DeltaCounterStore
58
+ histogramStore DeltaHistogramStore
59
59
aggregateDeltas bool
60
60
}
61
61
@@ -82,7 +82,17 @@ type MonitoringCollectorOptions struct {
82
82
AggregateDeltas bool
83
83
}
84
84
85
- func NewMonitoringCollector (projectID string , monitoringService * monitoring.Service , opts MonitoringCollectorOptions , logger log.Logger , counterStore DeltaCounterStore , distributionStore DeltaDistributionStore ) (* MonitoringCollector , error ) {
85
+ type DeltaCounterStore interface {
86
+ Increment (metricDescriptor * monitoring.MetricDescriptor , currentValue * ConstMetric )
87
+ ListMetrics (metricDescriptorName string ) []* ConstMetric
88
+ }
89
+
90
+ type DeltaHistogramStore interface {
91
+ Increment (metricDescriptor * monitoring.MetricDescriptor , currentValue * HistogramMetric )
92
+ ListMetrics (metricDescriptorName string ) []* HistogramMetric
93
+ }
94
+
95
+ func NewMonitoringCollector (projectID string , monitoringService * monitoring.Service , opts MonitoringCollectorOptions , logger log.Logger , counterStore DeltaCounterStore , histogramStore DeltaHistogramStore ) (* MonitoringCollector , error ) {
86
96
const subsystem = "monitoring"
87
97
88
98
apiCallsTotalMetric := prometheus .NewCounter (
@@ -162,8 +172,8 @@ func NewMonitoringCollector(projectID string, monitoringService *monitoring.Serv
162
172
collectorFillMissingLabels : opts .FillMissingLabels ,
163
173
monitoringDropDelegatedProjects : opts .DropDelegatedProjects ,
164
174
logger : logger ,
165
- deltaCounterStore : counterStore ,
166
- deltaDistributionStore : distributionStore ,
175
+ counterStore : counterStore ,
176
+ histogramStore : histogramStore ,
167
177
aggregateDeltas : opts .AggregateDeltas ,
168
178
}
169
179
@@ -346,8 +356,8 @@ func (c *MonitoringCollector) reportTimeSeriesMetrics(
346
356
timeSeriesMetrics , err := NewTimeSeriesMetrics (metricDescriptor ,
347
357
ch ,
348
358
c .collectorFillMissingLabels ,
349
- c .deltaCounterStore ,
350
- c .deltaDistributionStore ,
359
+ c .counterStore ,
360
+ c .histogramStore ,
351
361
c .aggregateDeltas ,
352
362
)
353
363
if err != nil {
0 commit comments