summaryrefslogtreecommitdiff
path: root/internal/config/config.go
blob: dea804b2894fffb0287c9ea3c231243a5dbfb7a7 (plain)
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
package config

import "time"

// Mode represents the ingestion mode
type Mode string

const (
	ModeRealtime Mode = "realtime"
	ModeHistoric Mode = "historic"
	ModeBackfill Mode = "backfill"
	ModeAuto     Mode = "auto"
	ModeWatch    Mode = "watch"
)

// Config holds all configuration for the prometheus-pusher
type Config struct {
	Mode            Mode
	PushgatewayURL  string
	PrometheusURL   string
	ClickHouseURL   string // ClickHouse HTTP URL (e.g. http://localhost:8123)
	ClickHouseTable string // ClickHouse table name (default: epimetheus_metrics)
	JobName         string
	Continuous      bool
	InputFile       string
	InputFormat     string
	MetricName      string
	HoursAgo        int
	StartHours      int
	EndHours        int
	Interval        int
	ResolveIPLabels []string // Labels containing IP addresses to resolve via DNS
}

// NewConfig creates a new Config with default values
func NewConfig() Config {
	return Config{
		Mode:            ModeRealtime,
		PushgatewayURL:  "http://localhost:9091",
		PrometheusURL:   "http://localhost:9090/api/v1/write",
		ClickHouseURL:   "",
		ClickHouseTable: "epimetheus_metrics",
		JobName:         "example_metrics_pusher",
		InputFormat:     "csv",
		HoursAgo:        24,
		StartHours:      48,
		EndHours:        0,
		Interval:        1,
		ResolveIPLabels: []string{"ip"}, // Default resolves 'ip' label
	}
}

// AutoIngestThreshold is the age threshold for auto mode routing
const AutoIngestThreshold = 5 * time.Minute

// DefaultHTTPTimeout is the default timeout for HTTP requests
const DefaultHTTPTimeout = 10 * time.Second