Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DataUnits = map[string]string{"C": "metric", "F": "imperial", "K": "internal"}
)
Functions ¶
This section is empty.
Types ¶
type ApiResponse ¶ added in v0.0.12
type ApiResponse interface { *OneCallCurrentData | *PollutionData }
type Gauge ¶ added in v0.0.12
type Gauge[T ApiResponse] struct { // contains filtered or unexported fields }
func (*Gauge[T]) Desc ¶ added in v0.0.12
func (g *Gauge[T]) Desc() *prometheus.Desc
func (*Gauge[T]) FromResponse ¶ added in v0.0.12
func (g *Gauge[T]) FromResponse(data any) prometheus.Metric
type Metric ¶ added in v0.0.12
type Metric interface { Desc() *prometheus.Desc FromResponse(any) prometheus.Metric }
func OneCallGauges ¶ added in v0.0.12
func PollutionGauges ¶ added in v0.0.12
type OneCallCurrentData ¶ added in v0.0.12
type OneCallCurrentData struct { Dt int `json:"dt"` Sunrise int `json:"sunrise"` Sunset int `json:"sunset"` Temp float64 `json:"temp"` FeelsLike float64 `json:"feels_like"` Pressure int `json:"pressure"` Humidity int `json:"humidity"` DewPoint float64 `json:"dew_point"` Clouds int `json:"clouds"` UVI float64 `json:"uvi"` Visibility int `json:"visibility"` WindSpeed float64 `json:"wind_speed"` WindGust float64 `json:"wind_gust,omitempty"` WindDeg float64 `json:"wind_deg"` Rain Rain `json:"rain,omitempty"` Snow Snow `json:"snow,omitempty"` Weather []Weather `json:"weather"` }
func CurrentByCoordinates ¶ added in v0.0.12
type OneCallData ¶ added in v0.0.12
type OneCallData struct { Latitude float64 `json:"lat"` Longitude float64 `json:"lon"` Timezone string `json:"timezone"` TimezoneOffset int `json:"timezone_offset"` Current OneCallCurrentData `json:"current,omitempty"` }
OneCallData the API should be called with exclude=minutely,hourly,daily,alerts
type OpenweatherCollector ¶
type OpenweatherCollector struct { *Settings Cache *ttlcache.Cache Locations []Location // contains filtered or unexported fields }
func NewOpenweatherCollector ¶
func NewOpenweatherCollector(settings *Settings, locationsStr string, cache *ttlcache.Cache) *OpenweatherCollector
NewOpenweatherCollector You must create a constructor for your collector that initializes every descriptor and returns a pointer to the collector
func (*OpenweatherCollector) Collect ¶
func (collector *OpenweatherCollector) Collect(ch chan<- prometheus.Metric)
Collect implements required collect function for all prometheus collectors
func (*OpenweatherCollector) Describe ¶
func (collector *OpenweatherCollector) Describe(ch chan<- *prometheus.Desc)
Describe Each and every collector must implement the Describe function. It essentially writes all descriptors to the prometheus desc channel.
type Pollution ¶ added in v0.0.12
type Pollution struct { Location struct { Longitude float64 `json:"lon"` Latitude float64 `json:"lat"` } `json:"coord"` List []PollutionData `json:"list"` }
type PollutionData ¶ added in v0.0.12
type PollutionData struct { Dt int `json:"dt"` Main struct { Aqi float64 `json:"aqi"` } `json:"main"` Components struct { Co float64 `json:"co"` No float64 `json:"no"` No2 float64 `json:"no2"` O3 float64 `json:"o3"` So2 float64 `json:"so2"` Pm25 float64 `json:"pm2_5"` Pm10 float64 `json:"pm10"` Nh3 float64 `json:"nh3"` } `json:"components"` }
func PollutionByCoordinates ¶ added in v0.0.12
Click to show internal directories.
Click to hide internal directories.