diff --git a/pkg/alloy/config.alloy.tmpl b/pkg/alloy/config.alloy.tmpl index ba774b0..e12e63d 100644 --- a/pkg/alloy/config.alloy.tmpl +++ b/pkg/alloy/config.alloy.tmpl @@ -131,6 +131,11 @@ prometheus.scrape "{{ $name }}" { {{ if $scrape.Address }}targets = [{ __address__ = "{{ $scrape.Address }}", }]{{ end }} {{ if $scrape.Self.Enable }}targets = prometheus.exporter.self.alloy.targets{{ end }} {{ if $scrape.Unix.Enable }}targets = prometheus.exporter.unix.host.targets{{ end }} + {{ if $scrape.ProxyURL }}proxy_url = "{{ $scrape.ProxyURL }}"{{ end }} + {{ if $scrape.HTTPHeaders }}http_headers = { + {{ range $k, $v := $scrape.HTTPHeaders }}"{{ $k }}" = ["{{ $v }}"], + {{ end }} + }{{ end }} forward_to = [ prometheus.relabel.{{ $name }}.receiver, diff --git a/pkg/alloy/config.go b/pkg/alloy/config.go index bdd7e24..db44261 100644 --- a/pkg/alloy/config.go +++ b/pkg/alloy/config.go @@ -32,9 +32,11 @@ type Config struct { type Scrape struct { IntervalSeconds uint `json:"intervalSeconds,omitempty"` - Address string `json:"address,omitempty"` - Self ScrapeSelf `json:"self,omitempty"` - Unix ScrapeUnix `json:"unix,omitempty"` + Address string `json:"address,omitempty"` + Self ScrapeSelf `json:"self,omitempty"` + Unix ScrapeUnix `json:"unix,omitempty"` + HTTPHeaders map[string]string `json:"httpheaders,omitempty"` + ProxyURL string `json:"proxyURL,omitempty"` Relabel []ScrapeRelabelRule `json:"relabel,omitempty"` } diff --git a/pkg/alloy/zz_generated.deepcopy.go b/pkg/alloy/zz_generated.deepcopy.go index f6e1d1b..844e84e 100644 --- a/pkg/alloy/zz_generated.deepcopy.go +++ b/pkg/alloy/zz_generated.deepcopy.go @@ -159,6 +159,13 @@ func (in *Scrape) DeepCopyInto(out *Scrape) { *out = *in out.Self = in.Self in.Unix.DeepCopyInto(&out.Unix) + if in.HTTPHeaders != nil { + in, out := &in.HTTPHeaders, &out.HTTPHeaders + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } if in.Relabel != nil { in, out := &in.Relabel, &out.Relabel *out = make([]ScrapeRelabelRule, len(*in))