To confirm the prior behavior, list multiple pipe-delimited locations (e.g. --location 'New York, US|Chicago, US') and curl the metrics endpoint. Each metric key will have the same value for both location tags.
This sets the cache key strings for each location in the Location struct when instantiated, then uses those keys in subsequent calls to the ttlcache when fetching data from the OWM API. I don't work with golang daily, so there may be a more idiomatic approach to fixing this. Suggestions welcome!
https://github.com/billykwooten/openweather-exporter/pull/29 introduced caching, but uses a common cache key for all locations in
OpenweatherCollector
resulting in the same result being returned for each location queried.To confirm the prior behavior, list multiple pipe-delimited locations (e.g.
--location 'New York, US|Chicago, US')
and curl the metrics endpoint. Each metric key will have the same value for both location tags.This sets the cache key strings for each location in the Location struct when instantiated, then uses those keys in subsequent calls to the ttlcache when fetching data from the OWM API. I don't work with golang daily, so there may be a more idiomatic approach to fixing this. Suggestions welcome!