Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prom: export config #704

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ func (hp *HTTPProxy) listen() (net.Listener, error) {
TLSHandshakeTimeout: hp.config.TLSServerConfig.HandshakeTimeout,
ReadLimit: int64(hp.config.ReadLimit),
WriteLimit: int64(hp.config.WriteLimit),
promConfig: promConfig{
PromConfig: PromConfig{
PromNamespace: hp.config.PromNamespace,
PromRegistry: hp.config.PromRegistry,
},
Expand Down
2 changes: 1 addition & 1 deletion http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type HTTPServerConfig struct {
WriteTimeout time.Duration
LogHTTPMode httplog.Mode
BasicAuth *url.Userinfo
promConfig
PromConfig
}

func DefaultHTTPServerConfig() *HTTPServerConfig {
Expand Down
4 changes: 2 additions & 2 deletions net.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type DialConfig struct {
// The keep-alive probes are sent with OS specific intervals.
KeepAlive bool

promConfig
PromConfig
}

func DefaultDialConfig() *DialConfig {
Expand Down Expand Up @@ -110,7 +110,7 @@ type Listener struct {
TLSHandshakeTimeout time.Duration
ReadLimit int64
WriteLimit int64
promConfig
PromConfig

listener net.Listener
metrics *listenerMetrics
Expand Down
14 changes: 7 additions & 7 deletions net_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestDialerMetrics(t *testing.T) {
r := prometheus.NewRegistry()
d := NewDialer(&DialConfig{
DialTimeout: 10 * time.Millisecond,
promConfig: promConfig{
PromConfig: PromConfig{
PromNamespace: "test",
PromRegistry: r,
},
Expand All @@ -61,7 +61,7 @@ func TestDialerMetricsErrors(t *testing.T) {
r := prometheus.NewRegistry()
d := NewDialer(&DialConfig{
DialTimeout: 10 * time.Millisecond,
promConfig: promConfig{
PromConfig: PromConfig{
PromNamespace: "test",
PromRegistry: r,
},
Expand Down Expand Up @@ -121,7 +121,7 @@ func TestListenerMetricsAccepted(t *testing.T) {
l := Listener{
Address: "localhost:0",
Log: log.NopLogger,
promConfig: promConfig{
PromConfig: PromConfig{
PromNamespace: "test",
PromRegistry: r,
},
Expand Down Expand Up @@ -152,7 +152,7 @@ func TestListenerMetricsAcceptedWithTLS(t *testing.T) {
Address: "localhost:0",
Log: log.NopLogger,
TLSConfig: selfSingedCert(),
promConfig: promConfig{
PromConfig: PromConfig{
PromNamespace: "test",
PromRegistry: r,
},
Expand Down Expand Up @@ -183,7 +183,7 @@ func TestListenerMetricsClosed(t *testing.T) {
l := Listener{
Address: "localhost:0",
Log: log.NopLogger,
promConfig: promConfig{
PromConfig: PromConfig{
PromNamespace: "test",
PromRegistry: r,
},
Expand Down Expand Up @@ -222,7 +222,7 @@ func TestListenerMetricsErrors(t *testing.T) {
l := Listener{
Address: "localhost:0",
Log: log.NopLogger,
promConfig: promConfig{
PromConfig: PromConfig{
PromNamespace: "test",
PromRegistry: r,
},
Expand Down Expand Up @@ -250,7 +250,7 @@ func TestListenerTLSHandshakeTimeout(t *testing.T) {
Log: log.NopLogger,
TLSConfig: selfSingedCert(),
TLSHandshakeTimeout: 100 * time.Millisecond,
promConfig: promConfig{
PromConfig: PromConfig{
PromNamespace: "test",
PromRegistry: r,
},
Expand Down
4 changes: 2 additions & 2 deletions prom.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/prometheus/client_golang/prometheus"
)

// promConfig is a configuration for Prometheus metrics.
type promConfig struct {
// PromConfig is a configuration for Prometheus metrics.
type PromConfig struct {
PromNamespace string
PromRegistry prometheus.Registerer
}
Loading