Skip to content

Commit

Permalink
Update worker.go
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelbirkner committed Sep 13, 2023
1 parent 89c4a3f commit cd81db7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cmd/telemetrygen/internal/metrics/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ type worker struct {
index int // worker index
}

func (w worker) simulateMetrics(res *resource.Resource, exporter sdkmetric.Exporter) {
func (w worker) simulateMetrics(res *resource.Resource, exporter sdkmetric.Exporter, attributes []attribute.KeyValue) {
limiter := rate.NewLimiter(w.limitPerSecond, 1)

var i int64
value := 24.42
attrs := attribute.NewSet(attribute.KeyValue{
Key: attribute.Key("node_id"),
Value: attribute.StringValue("test"),
})
attrs := attribute.NewSet(attributes...)

for w.running.Load() {
rm := metricdata.ResourceMetrics{
Expand All @@ -48,8 +45,9 @@ func (w worker) simulateMetrics(res *resource.Resource, exporter sdkmetric.Expor
Data: metricdata.Gauge[int64]{
DataPoints: []metricdata.DataPoint[int64]{
{
Time: time.Now(),
Value: i,
Attributes: attrs,
Time: time.Now(),
Value: i,
},
},
},
Expand Down

0 comments on commit cd81db7

Please sign in to comment.