| 135 | } |
| 136 | |
| 137 | func (am *annotatedMetric) shallowCopy() annotatedMetric { |
| 138 | stats := &agentproto.Stats_Metric{ |
| 139 | Name: am.Name, |
| 140 | Type: am.Type, |
| 141 | Value: am.Value, |
| 142 | Labels: am.Labels, |
| 143 | } |
| 144 | |
| 145 | return annotatedMetric{ |
| 146 | Stats_Metric: stats, |
| 147 | username: am.username, |
| 148 | workspaceName: am.workspaceName, |
| 149 | agentName: am.agentName, |
| 150 | templateName: am.templateName, |
| 151 | expiryDate: am.expiryDate, |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | func NewMetricsAggregator(logger slog.Logger, registerer prometheus.Registerer, duration time.Duration, aggregateByLabels []string, options ...func(*MetricsAggregator)) (*MetricsAggregator, error) { |
| 156 | metricsCleanupInterval := defaultMetricsCleanupInterval |