-
Notifications
You must be signed in to change notification settings - Fork 143
/
nginx_vts_exporter.go
433 lines (386 loc) · 19.9 KB
/
nginx_vts_exporter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
package main
import (
"context"
"crypto/tls"
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
"time"
"github.com/go-kod/kod"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
cversion "github.com/prometheus/client_golang/prometheus/collectors/version"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/version"
)
//go:generate go run github.com/go-kod/kod/cmd/kod generate .
type NginxVts struct {
HostName string `json:"hostName"`
NginxVersion string `json:"nginxVersion"`
LoadMsec int64 `json:"loadMsec"`
NowMsec int64 `json:"nowMsec"`
Connections struct {
Active uint64 `json:"active"`
Reading uint64 `json:"reading"`
Writing uint64 `json:"writing"`
Waiting uint64 `json:"waiting"`
Accepted uint64 `json:"accepted"`
Handled uint64 `json:"handled"`
Requests uint64 `json:"requests"`
} `json:"connections"`
SharedZones struct {
Name string `json:"name"`
MaxSize uint64 `json:"maxSize"`
UsedSize uint64 `json:"usedSize"`
UsedNode uint64 `json:"usedNode"`
} `json:"sharedZones"`
ServerZones map[string]Server `json:"serverZones"`
UpstreamZones map[string][]Upstream `json:"upstreamZones"`
FilterZones map[string]map[string]Upstream `json:"filterZones"`
CacheZones map[string]Cache `json:"cacheZones"`
}
type Server struct {
RequestCounter uint64 `json:"requestCounter"`
InBytes uint64 `json:"inBytes"`
OutBytes uint64 `json:"outBytes"`
RequestMsec uint64 `json:"requestMsec"`
Responses struct {
OneXx uint64 `json:"1xx"`
TwoXx uint64 `json:"2xx"`
ThreeXx uint64 `json:"3xx"`
FourXx uint64 `json:"4xx"`
FiveXx uint64 `json:"5xx"`
Miss uint64 `json:"miss"`
Bypass uint64 `json:"bypass"`
Expired uint64 `json:"expired"`
Stale uint64 `json:"stale"`
Updating uint64 `json:"updating"`
Revalidated uint64 `json:"revalidated"`
Hit uint64 `json:"hit"`
Scarce uint64 `json:"scarce"`
} `json:"responses"`
OverCounts struct {
MaxIntegerSize float64 `json:"maxIntegerSize"`
RequestCounter uint64 `json:"requestCounter"`
InBytes uint64 `json:"inBytes"`
OutBytes uint64 `json:"outBytes"`
OneXx uint64 `json:"1xx"`
TwoXx uint64 `json:"2xx"`
ThreeXx uint64 `json:"3xx"`
FourXx uint64 `json:"4xx"`
FiveXx uint64 `json:"5xx"`
Miss uint64 `json:"miss"`
Bypass uint64 `json:"bypass"`
Expired uint64 `json:"expired"`
Stale uint64 `json:"stale"`
Updating uint64 `json:"updating"`
Revalidated uint64 `json:"revalidated"`
Hit uint64 `json:"hit"`
Scarce uint64 `json:"scarce"`
} `json:"overCounts"`
}
type Upstream struct {
Server string `json:"server"`
RequestCounter uint64 `json:"requestCounter"`
InBytes uint64 `json:"inBytes"`
OutBytes uint64 `json:"outBytes"`
Responses struct {
OneXx uint64 `json:"1xx"`
TwoXx uint64 `json:"2xx"`
ThreeXx uint64 `json:"3xx"`
FourXx uint64 `json:"4xx"`
FiveXx uint64 `json:"5xx"`
} `json:"responses"`
ResponseMsec uint64 `json:"responseMsec"`
RequestMsec uint64 `json:"requestMsec"`
Weight uint64 `json:"weight"`
MaxFails uint64 `json:"maxFails"`
FailTimeout uint64 `json:"failTimeout"`
Backup bool `json:"backup"`
Down bool `json:"down"`
OverCounts struct {
MaxIntegerSize float64 `json:"maxIntegerSize"`
RequestCounter uint64 `json:"requestCounter"`
InBytes uint64 `json:"inBytes"`
OutBytes uint64 `json:"outBytes"`
OneXx uint64 `json:"1xx"`
TwoXx uint64 `json:"2xx"`
ThreeXx uint64 `json:"3xx"`
FourXx uint64 `json:"4xx"`
FiveXx uint64 `json:"5xx"`
} `json:"overCounts"`
}
type Cache struct {
MaxSize uint64 `json:"maxSize"`
UsedSize uint64 `json:"usedSize"`
InBytes uint64 `json:"inBytes"`
OutBytes uint64 `json:"outBytes"`
Responses struct {
Miss uint64 `json:"miss"`
Bypass uint64 `json:"bypass"`
Expired uint64 `json:"expired"`
Stale uint64 `json:"stale"`
Updating uint64 `json:"updating"`
Revalidated uint64 `json:"revalidated"`
Hit uint64 `json:"hit"`
Scarce uint64 `json:"scarce"`
} `json:"responses"`
OverCounts struct {
MaxIntegerSize float64 `json:"maxIntegerSize"`
InBytes uint64 `json:"inBytes"`
OutBytes uint64 `json:"outBytes"`
Miss uint64 `json:"miss"`
Bypass uint64 `json:"bypass"`
Expired uint64 `json:"expired"`
Stale uint64 `json:"stale"`
Updating uint64 `json:"updating"`
Revalidated uint64 `json:"revalidated"`
Hit uint64 `json:"hit"`
Scarce uint64 `json:"scarce"`
} `json:"overCounts"`
}
type Exporter struct {
URI string
infoMetric *prometheus.Desc
serverMetrics, upstreamMetrics, filterMetrics, cacheMetrics map[string]*prometheus.Desc
}
func newServerMetric(metricName string, docString string, labels []string) *prometheus.Desc {
return prometheus.NewDesc(
prometheus.BuildFQName(*metricsNamespace, "server", metricName),
docString, labels, nil,
)
}
func newUpstreamMetric(metricName string, docString string, labels []string) *prometheus.Desc {
return prometheus.NewDesc(
prometheus.BuildFQName(*metricsNamespace, "upstream", metricName),
docString, labels, nil,
)
}
func newFilterMetric(metricName string, docString string, labels []string) *prometheus.Desc {
return prometheus.NewDesc(
prometheus.BuildFQName(*metricsNamespace, "filter", metricName),
docString, labels, nil,
)
}
func newCacheMetric(metricName string, docString string, labels []string) *prometheus.Desc {
return prometheus.NewDesc(
prometheus.BuildFQName(*metricsNamespace, "cache", metricName),
docString, labels, nil,
)
}
func NewExporter(uri string) *Exporter {
return &Exporter{
URI: uri,
infoMetric: newServerMetric("info", "nginx info", []string{"hostName", "nginxVersion"}),
serverMetrics: map[string]*prometheus.Desc{
"connections": newServerMetric("connections", "nginx connections", []string{"status"}),
"requests": newServerMetric("requests", "requests counter", []string{"host", "code"}),
"bytes": newServerMetric("bytes", "request/response bytes", []string{"host", "direction"}),
"cache": newServerMetric("cache", "cache counter", []string{"host", "status"}),
"requestMsec": newServerMetric("requestMsec", "average of request processing times in milliseconds", []string{"host"}),
"sharedzones": newServerMetric("sharedzones", "vts module shared memory metrics", []string{"name", "memstat"}),
},
upstreamMetrics: map[string]*prometheus.Desc{
"requests": newUpstreamMetric("requests", "requests counter", []string{"upstream", "code", "backend"}),
"bytes": newUpstreamMetric("bytes", "request/response bytes", []string{"upstream", "direction", "backend"}),
"responseMsec": newUpstreamMetric("responseMsec", "average of only upstream/backend response processing times in milliseconds", []string{"upstream", "backend"}),
"requestMsec": newUpstreamMetric("requestMsec", "average of request processing times in milliseconds", []string{"upstream", "backend"}),
},
filterMetrics: map[string]*prometheus.Desc{
"requests": newFilterMetric("requests", "requests counter", []string{"filter", "filterName", "code"}),
"bytes": newFilterMetric("bytes", "request/response bytes", []string{"filter", "filterName", "direction"}),
"responseMsec": newFilterMetric("responseMsec", "average of only upstream/backend response processing times in milliseconds", []string{"filter", "filterName"}),
"requestMsec": newFilterMetric("requestMsec", "average of request processing times in milliseconds", []string{"filter", "filterName"}),
},
cacheMetrics: map[string]*prometheus.Desc{
"requests": newCacheMetric("requests", "cache requests counter", []string{"zone", "status"}),
"bytes": newCacheMetric("bytes", "cache request/response bytes", []string{"zone", "direction"}),
},
}
}
func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
for _, m := range e.serverMetrics {
ch <- m
}
for _, m := range e.upstreamMetrics {
ch <- m
}
for _, m := range e.filterMetrics {
ch <- m
}
for _, m := range e.cacheMetrics {
ch <- m
}
}
func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
body, err := fetchHTTP(e.URI, time.Duration(*nginxScrapeTimeout)*time.Second)()
if err != nil {
log.Println("fetchHTTP failed", err)
return
}
defer body.Close()
data, err := io.ReadAll(body)
if err != nil {
log.Println("ioutil.ReadAll failed", err)
return
}
var nginxVtx NginxVts
err = json.Unmarshal(data, &nginxVtx)
if err != nil {
log.Println("json.Unmarshal failed", err)
return
}
// info
uptime := (nginxVtx.NowMsec - nginxVtx.LoadMsec) / 1000
ch <- prometheus.MustNewConstMetric(e.infoMetric, prometheus.GaugeValue, float64(uptime), nginxVtx.HostName, nginxVtx.NginxVersion)
// connections
ch <- prometheus.MustNewConstMetric(e.serverMetrics["connections"], prometheus.GaugeValue, float64(nginxVtx.Connections.Active), "active")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["connections"], prometheus.GaugeValue, float64(nginxVtx.Connections.Reading), "reading")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["connections"], prometheus.GaugeValue, float64(nginxVtx.Connections.Waiting), "waiting")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["connections"], prometheus.GaugeValue, float64(nginxVtx.Connections.Writing), "writing")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["connections"], prometheus.GaugeValue, float64(nginxVtx.Connections.Accepted), "accepted")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["connections"], prometheus.GaugeValue, float64(nginxVtx.Connections.Handled), "handled")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["connections"], prometheus.GaugeValue, float64(nginxVtx.Connections.Requests), "requests")
// sharedzones
ch <- prometheus.MustNewConstMetric(e.serverMetrics["sharedzones"], prometheus.GaugeValue, float64(nginxVtx.SharedZones.MaxSize), nginxVtx.SharedZones.Name, "maxsize")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["sharedzones"], prometheus.GaugeValue, float64(nginxVtx.SharedZones.UsedSize), nginxVtx.SharedZones.Name, "usedsize")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["sharedzones"], prometheus.GaugeValue, float64(nginxVtx.SharedZones.UsedNode), nginxVtx.SharedZones.Name, "usednode")
// ServerZones
for host, s := range nginxVtx.ServerZones {
ch <- prometheus.MustNewConstMetric(e.serverMetrics["requests"], prometheus.CounterValue, float64(s.RequestCounter), host, "total")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["requests"], prometheus.CounterValue, float64(s.Responses.OneXx), host, "1xx")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["requests"], prometheus.CounterValue, float64(s.Responses.TwoXx), host, "2xx")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["requests"], prometheus.CounterValue, float64(s.Responses.ThreeXx), host, "3xx")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["requests"], prometheus.CounterValue, float64(s.Responses.FourXx), host, "4xx")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["requests"], prometheus.CounterValue, float64(s.Responses.FiveXx), host, "5xx")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["cache"], prometheus.CounterValue, float64(s.Responses.Bypass), host, "bypass")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["cache"], prometheus.CounterValue, float64(s.Responses.Expired), host, "expired")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["cache"], prometheus.CounterValue, float64(s.Responses.Hit), host, "hit")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["cache"], prometheus.CounterValue, float64(s.Responses.Miss), host, "miss")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["cache"], prometheus.CounterValue, float64(s.Responses.Revalidated), host, "revalidated")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["cache"], prometheus.CounterValue, float64(s.Responses.Scarce), host, "scarce")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["cache"], prometheus.CounterValue, float64(s.Responses.Stale), host, "stale")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["cache"], prometheus.CounterValue, float64(s.Responses.Updating), host, "updating")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["bytes"], prometheus.CounterValue, float64(s.InBytes), host, "in")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["bytes"], prometheus.CounterValue, float64(s.OutBytes), host, "out")
ch <- prometheus.MustNewConstMetric(e.serverMetrics["requestMsec"], prometheus.GaugeValue, float64(s.RequestMsec), host)
}
// UpstreamZones
for name, upstreamList := range nginxVtx.UpstreamZones {
for _, s := range upstreamList {
ch <- prometheus.MustNewConstMetric(e.upstreamMetrics["responseMsec"], prometheus.GaugeValue, float64(s.ResponseMsec), name, s.Server)
ch <- prometheus.MustNewConstMetric(e.upstreamMetrics["requestMsec"], prometheus.GaugeValue, float64(s.RequestMsec), name, s.Server)
ch <- prometheus.MustNewConstMetric(e.upstreamMetrics["requests"], prometheus.CounterValue, float64(s.RequestCounter), name, "total", s.Server)
ch <- prometheus.MustNewConstMetric(e.upstreamMetrics["requests"], prometheus.CounterValue, float64(s.Responses.OneXx), name, "1xx", s.Server)
ch <- prometheus.MustNewConstMetric(e.upstreamMetrics["requests"], prometheus.CounterValue, float64(s.Responses.TwoXx), name, "2xx", s.Server)
ch <- prometheus.MustNewConstMetric(e.upstreamMetrics["requests"], prometheus.CounterValue, float64(s.Responses.ThreeXx), name, "3xx", s.Server)
ch <- prometheus.MustNewConstMetric(e.upstreamMetrics["requests"], prometheus.CounterValue, float64(s.Responses.FourXx), name, "4xx", s.Server)
ch <- prometheus.MustNewConstMetric(e.upstreamMetrics["requests"], prometheus.CounterValue, float64(s.Responses.FiveXx), name, "5xx", s.Server)
ch <- prometheus.MustNewConstMetric(e.upstreamMetrics["bytes"], prometheus.CounterValue, float64(s.InBytes), name, "in", s.Server)
ch <- prometheus.MustNewConstMetric(e.upstreamMetrics["bytes"], prometheus.CounterValue, float64(s.OutBytes), name, "out", s.Server)
}
}
// FilterZones
for filter, values := range nginxVtx.FilterZones {
for name, stat := range values {
ch <- prometheus.MustNewConstMetric(e.filterMetrics["responseMsec"], prometheus.GaugeValue, float64(stat.ResponseMsec), filter, name)
ch <- prometheus.MustNewConstMetric(e.filterMetrics["requestMsec"], prometheus.GaugeValue, float64(stat.RequestMsec), filter, name)
ch <- prometheus.MustNewConstMetric(e.filterMetrics["requests"], prometheus.CounterValue, float64(stat.RequestCounter), filter, name, "total")
ch <- prometheus.MustNewConstMetric(e.filterMetrics["requests"], prometheus.CounterValue, float64(stat.Responses.OneXx), filter, name, "1xx")
ch <- prometheus.MustNewConstMetric(e.filterMetrics["requests"], prometheus.CounterValue, float64(stat.Responses.TwoXx), filter, name, "2xx")
ch <- prometheus.MustNewConstMetric(e.filterMetrics["requests"], prometheus.CounterValue, float64(stat.Responses.ThreeXx), filter, name, "3xx")
ch <- prometheus.MustNewConstMetric(e.filterMetrics["requests"], prometheus.CounterValue, float64(stat.Responses.FourXx), filter, name, "4xx")
ch <- prometheus.MustNewConstMetric(e.filterMetrics["requests"], prometheus.CounterValue, float64(stat.Responses.FiveXx), filter, name, "5xx")
ch <- prometheus.MustNewConstMetric(e.filterMetrics["bytes"], prometheus.CounterValue, float64(stat.InBytes), filter, name, "in")
ch <- prometheus.MustNewConstMetric(e.filterMetrics["bytes"], prometheus.CounterValue, float64(stat.OutBytes), filter, name, "out")
}
}
// CacheZones
for zone, s := range nginxVtx.CacheZones {
ch <- prometheus.MustNewConstMetric(e.cacheMetrics["requests"], prometheus.CounterValue, float64(s.Responses.Bypass), zone, "bypass")
ch <- prometheus.MustNewConstMetric(e.cacheMetrics["requests"], prometheus.CounterValue, float64(s.Responses.Expired), zone, "expired")
ch <- prometheus.MustNewConstMetric(e.cacheMetrics["requests"], prometheus.CounterValue, float64(s.Responses.Hit), zone, "hit")
ch <- prometheus.MustNewConstMetric(e.cacheMetrics["requests"], prometheus.CounterValue, float64(s.Responses.Miss), zone, "miss")
ch <- prometheus.MustNewConstMetric(e.cacheMetrics["requests"], prometheus.CounterValue, float64(s.Responses.Revalidated), zone, "revalidated")
ch <- prometheus.MustNewConstMetric(e.cacheMetrics["requests"], prometheus.CounterValue, float64(s.Responses.Scarce), zone, "scarce")
ch <- prometheus.MustNewConstMetric(e.cacheMetrics["requests"], prometheus.CounterValue, float64(s.Responses.Stale), zone, "stale")
ch <- prometheus.MustNewConstMetric(e.cacheMetrics["requests"], prometheus.CounterValue, float64(s.Responses.Updating), zone, "updating")
ch <- prometheus.MustNewConstMetric(e.cacheMetrics["bytes"], prometheus.CounterValue, float64(s.InBytes), zone, "in")
ch <- prometheus.MustNewConstMetric(e.cacheMetrics["bytes"], prometheus.CounterValue, float64(s.OutBytes), zone, "out")
}
}
func fetchHTTP(uri string, timeout time.Duration) func() (io.ReadCloser, error) {
http.DefaultClient.Timeout = timeout
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: *insecure}
return func() (io.ReadCloser, error) {
resp, err := http.DefaultClient.Get(uri)
if err != nil {
return nil, err
}
if !(resp.StatusCode >= 200 && resp.StatusCode < 300) {
resp.Body.Close()
return nil, fmt.Errorf("HTTP status %d", resp.StatusCode)
}
return resp.Body, nil
}
}
var (
showVersion = flag.Bool("version", false, "Print version information.")
listenAddress = flag.String("telemetry.address", ":9913", "Address on which to expose metrics.")
metricsEndpoint = flag.String("telemetry.endpoint", "/metrics", "Path under which to expose metrics.")
metricsNamespace = flag.String("metrics.namespace", "nginx", "Prometheus metrics namespace.")
nginxScrapeURI = flag.String("nginx.scrape_uri", "http://localhost/status", "URI to nginx stub status page")
insecure = flag.Bool("insecure", true, "Ignore server certificate if using https")
nginxScrapeTimeout = flag.Int("nginx.scrape_timeout", 2, "The number of seconds to wait for an HTTP response from the nginx.scrape_uri")
goMetrics = flag.Bool("go.metrics", false, "Export process and go metrics.")
)
func init() {
prometheus.MustRegister(cversion.NewCollector("nginx_vts_exporter"))
}
type app struct {
kod.Implements[kod.Main]
}
func (*app) run() {
flag.Parse()
if *showVersion {
fmt.Fprintln(os.Stdout, version.Print("nginx_vts_exporter"))
os.Exit(0)
}
log.Printf("Starting nginx_vts_exporter %s", version.Info())
log.Printf("Build context %s", version.BuildContext())
exporter := NewExporter(*nginxScrapeURI)
prometheus.MustRegister(exporter)
if !(*goMetrics) {
prometheus.Unregister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{
PidFn: func() (int, error) {
return os.Getpid(), nil
},
}))
prometheus.Unregister(collectors.NewGoCollector())
}
http.Handle(*metricsEndpoint, promhttp.Handler())
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(`<html>
<head><title>Nginx Exporter</title></head>
<body>
<h1>Nginx Exporter</h1>
<p><a href="` + *metricsEndpoint + `">Metrics</a></p>
</body>
</html>`))
})
log.Printf("Starting Server at : %s", *listenAddress)
log.Printf("Metrics endpoint: %s", *metricsEndpoint)
log.Printf("Metrics namespace: %s", *metricsNamespace)
log.Printf("Scraping information from : %s", *nginxScrapeURI)
log.Fatal(http.ListenAndServe(*listenAddress, nil))
}
func main() {
_ = kod.Run(context.Background(), func(ctx context.Context, app *app) error {
app.run()
return nil
})
}