fix recorder
This commit is contained in:
		| @@ -26,7 +26,7 @@ func (w *WeatherRecorder) Get(ctx context.Context, last int) ( | ||||
| 	span.SetAttributes( | ||||
| 		attribute.Int("last", last), | ||||
| 		attribute.Int("keep", w.keep), | ||||
| 		attribute.Int("currentSize", w.Count()), | ||||
| 		attribute.Int("currentSize", w.Count(ctx)), | ||||
| 	) | ||||
| 	defer span.End() | ||||
|  | ||||
| @@ -47,7 +47,7 @@ func (w *WeatherRecorder) get(ctx context.Context, last int) ( | ||||
| 	span := trace.SpanFromContext(ctx) | ||||
|  | ||||
| 	w.RLock() | ||||
| 	defer w.Unlock() | ||||
| 	defer w.RUnlock() | ||||
|  | ||||
| 	span.AddEvent("acquired lock on recorder cache") | ||||
|  | ||||
| @@ -70,8 +70,8 @@ func (w *WeatherRecorder) get(ctx context.Context, last int) ( | ||||
| } | ||||
|  | ||||
| // Returns count of retained weather updates | ||||
| func (w *WeatherRecorder) Count() int { | ||||
| 	_, span := w.tracer.Start(w.ctx, "countWeatherRecorder") | ||||
| func (w *WeatherRecorder) Count(ctx context.Context) int { | ||||
| 	_, span := w.tracer.Start(ctx, "countWeatherRecorder") | ||||
| 	defer span.End() | ||||
|  | ||||
| 	count := w.count() | ||||
|   | ||||
| @@ -10,9 +10,9 @@ import ( | ||||
| ) | ||||
|  | ||||
| func (w *WeatherRecorder) Set(ctx context.Context, u *weather.WeatherUpdate) error { | ||||
| 	_, span := w.tracer.Start(ctx, "recordWeatherUpdate") | ||||
| 	ctx, span := w.tracer.Start(ctx, "recordWeatherUpdate") | ||||
| 	span.SetAttributes( | ||||
| 		attribute.Int("countWeatherUpdates", w.Count()), | ||||
| 		attribute.Int("countWeatherUpdates", w.Count(ctx)), | ||||
| 		attribute.Int("keepUpdates", w.keep), | ||||
| 	) | ||||
| 	defer span.End() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user