This commit is contained in:
		@@ -105,6 +105,11 @@ func (aw *AmbientWeather) handleProviderRequest(
 | 
			
		||||
	// Perform enrichment
 | 
			
		||||
	aw.enrichUpdate(ctx, p, update)
 | 
			
		||||
 | 
			
		||||
	// We may know which station this was for now
 | 
			
		||||
	if update.StationConfig != nil {
 | 
			
		||||
		updateSpan.SetAttributes(attribute.String("stationName", update.StationConfig.Name))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Update metrics
 | 
			
		||||
	aw.metricsUpdate(ctx, p, update)
 | 
			
		||||
 | 
			
		||||
@@ -122,6 +127,30 @@ func (aw *AmbientWeather) handleProviderRequest(
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (aw *AmbientWeather) enrichUpdate(
 | 
			
		||||
	ctx context.Context,
 | 
			
		||||
	p provider.AmbientProvider,
 | 
			
		||||
	update *weather.WeatherUpdate,
 | 
			
		||||
) {
 | 
			
		||||
	tracer := otel.GetTracer(aw.appCtx, p.Name()+".http.handler")
 | 
			
		||||
 | 
			
		||||
	// Calculate any fields that may be missing
 | 
			
		||||
	// such as dew point and wind chill
 | 
			
		||||
	_, enrichSpan := tracer.Start(ctx, p.Name()+".update.enrich")
 | 
			
		||||
	defer enrichSpan.End()
 | 
			
		||||
 | 
			
		||||
	// Metric enrichment
 | 
			
		||||
	update.Enrich()
 | 
			
		||||
 | 
			
		||||
	// Enrich station if configured
 | 
			
		||||
	aw.enrichStation(update)
 | 
			
		||||
 | 
			
		||||
	// Map sensor names
 | 
			
		||||
	update.MapSensors()
 | 
			
		||||
 | 
			
		||||
	enrichSpan.SetStatus(codes.Ok, "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (aw *AmbientWeather) metricsUpdate(
 | 
			
		||||
	ctx context.Context,
 | 
			
		||||
	p provider.AmbientProvider,
 | 
			
		||||
@@ -140,29 +169,6 @@ func (aw *AmbientWeather) metricsUpdate(
 | 
			
		||||
	metricsSpan.End()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (aw *AmbientWeather) enrichUpdate(
 | 
			
		||||
	ctx context.Context,
 | 
			
		||||
	p provider.AmbientProvider,
 | 
			
		||||
	update *weather.WeatherUpdate,
 | 
			
		||||
) {
 | 
			
		||||
	tracer := otel.GetTracer(aw.appCtx, p.Name()+".http.handler")
 | 
			
		||||
 | 
			
		||||
	// Calculate any fields that may be missing
 | 
			
		||||
	// such as dew point and wind chill
 | 
			
		||||
	_, enrichSpan := tracer.Start(ctx, p.Name()+".update.enrich")
 | 
			
		||||
	defer enrichSpan.End()
 | 
			
		||||
 | 
			
		||||
	update.Enrich()
 | 
			
		||||
 | 
			
		||||
	// Enrich station if configured
 | 
			
		||||
	aw.enrichStation(update)
 | 
			
		||||
 | 
			
		||||
	// Map sensor names
 | 
			
		||||
	update.MapSensors()
 | 
			
		||||
 | 
			
		||||
	enrichSpan.SetStatus(codes.Ok, "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (aw *AmbientWeather) proxyUpdate(
 | 
			
		||||
	ctx context.Context,
 | 
			
		||||
	p provider.AmbientProvider,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user