Skip to content

Commit

Permalink
rename option
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaojianli committed Jan 20, 2025
1 parent 931ad4a commit 8715456
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ func (fn option) apply(cfg *config) {
}

type config struct {
buckets []float64
enableGoCollector bool
registry *prom.Registry
runtimeMetricRules []collectors.GoRuntimeMetricsRule
disableServer bool
useDefaultServer bool
buckets []float64
enableGoCollector bool
registry *prom.Registry
runtimeMetricRules []collectors.GoRuntimeMetricsRule
disableServer bool
useDefaultMuxServer bool
}

func defaultConfig() *config {
return &config{
buckets: defaultBuckets,
enableGoCollector: false,
registry: prom.NewRegistry(),
disableServer: false,
useDefaultServer: true,
buckets: defaultBuckets,
enableGoCollector: false,
registry: prom.NewRegistry(),
disableServer: false,
useDefaultMuxServer: true,
}
}

Expand Down Expand Up @@ -92,9 +92,9 @@ func WithRegistry(registry *prom.Registry) Option {
})
}

// WithDefaultServer use default http server
func WithDefaultServer(useDefault bool) Option {
// WithDefaultMuxServer use default http mux server
func WithDefaultMuxServer(useDefault bool) Option {
return option(func(cfg *config) {
cfg.useDefaultServer = useDefault
cfg.useDefaultMuxServer = useDefault
})
}
2 changes: 1 addition & 1 deletion trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func NewServerTracer(addr, path string, opts ...Option) tracer.Tracer {

if !cfg.disableServer {
httpServer := http.DefaultServeMux
if !cfg.useDefaultServer {
if !cfg.useDefaultMuxServer {
httpServer = http.NewServeMux()
}
httpServer.Handle(path, promhttp.HandlerFor(cfg.registry, promhttp.HandlerOpts{ErrorHandling: promhttp.ContinueOnError}))
Expand Down

0 comments on commit 8715456

Please sign in to comment.