Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Commit

Permalink
feat(agent/sd): add support HTTP service discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
scottzhlin committed Dec 9, 2022
1 parent ee1103b commit ac09c62
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,10 @@ static_configs:
kubernetes_sd_configs:
[ - <kubernetes_sd_config> ... ]
# List of HTTP service discovery configurations.
http_sd_configs:
[ - <http_sd_config> ... ]
# Sets the `Authorization` header on every scrape request with the
# configured username and password.
# password and password_file are mutually exclusive.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ static_configs:
kubernetes_sd_configs:
[ - <kubernetes_sd_config> ... ]

# List of HTTP service discovery configurations.
http_sd_configs:
[ - <http_sd_config> ... ]

# Sets the `Authorization` header on every scrape request with the
# configured username and password.
# password and password_file are mutually exclusive.
Expand Down
6 changes: 6 additions & 0 deletions pkg/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"path/filepath"
"time"

"github.com/prometheus/prometheus/discovery/http"

"github.com/grafana/dskit/flagext"
"github.com/parca-dev/parca/pkg/config"
parcaconfig "github.com/parca-dev/parca/pkg/config"
Expand Down Expand Up @@ -139,6 +141,7 @@ func (c *ScrapeConfig) Validate() error {
type ServiceDiscoveryConfig struct {
StaticConfigs discovery.StaticConfig `yaml:"static_configs"`
KubernetesSDConfigs []*kubernetes.SDConfig `yaml:"kubernetes_sd_configs,omitempty"`
HTTPSDConfigs []*http.SDConfig `yaml:"http_sd_configs,omitempty"`
}

func (cfg ServiceDiscoveryConfig) Configs() (res discovery.Configs) {
Expand All @@ -148,5 +151,8 @@ func (cfg ServiceDiscoveryConfig) Configs() (res discovery.Configs) {
for _, x := range cfg.KubernetesSDConfigs {
res = append(res, x)
}
for _, x := range cfg.HTTPSDConfigs {
res = append(res, x)
}
return res
}
13 changes: 9 additions & 4 deletions pkg/gen/google/v1/profile.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac09c62

Please sign in to comment.