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

Metrics not updated automatically #97

Open
atul161 opened this issue Mar 5, 2021 · 0 comments
Open

Metrics not updated automatically #97

atul161 opened this issue Mar 5, 2021 · 0 comments

Comments

@atul161
Copy link

atul161 commented Mar 5, 2021

ctx, cancel := context.WithCancel(ctx)
defer cancel()

srv := &http.Server{
	Addr:    config.ServerHost + ":" + config.PromthesiusPort,
	Handler: promhttp.HandlerFor(promthesusConfig.Registry, promhttp.HandlerOpts{}),
}
//initializing metrics
promthesusConfig.ServerMetrics.InitializeMetrics(grpcServer)
grpc_prometheus.Register(grpcServer)
// graceful shutdown
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func() {
	for range c {
		// sig is a ^C, handle it
	}
	_, cancel := context.WithTimeout(ctx, 30*time.Second)
	defer cancel()
	logger.Log.Info("graceful shutting down promthesius Server")
	_ = srv.Shutdown(ctx)
}()

when i open a port ..it already intiliased with the default metrics ...but when we hit new request on server ..then the details not updated automatically. After refreshing same problem happens

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant