service rename

This commit is contained in:
Abhishek Pandey 2023-10-06 17:17:53 +05:30
parent 97953f76db
commit e4cbae0a5e
2 changed files with 2 additions and 58 deletions

View File

@ -32,7 +32,7 @@ type randomMetricCollector struct {
func NewRandomMetricCollector(mp metric.MeterProvider) randomMetricCollector {
rmc := randomMetricCollector{}
rmc.meter = mp.Meter("corso-meters")
rmc.meter = mp.Meter("corso-collection")
rmc.registerCounter()
// rmc.registerCpuUsage()
return rmc
@ -110,7 +110,7 @@ func StartClient(ctx context.Context) (func(context.Context) error, error) {
}
res := resource.NewWithAttributes(
semconv.SchemaURL,
semconv.ServiceName("corso-metrics"),
semconv.ServiceName("go-sample-app"),
)
if _, present := os.LookupEnv("OTEL_RESOURCE_ATTRIBUTES"); present {
envResource, err := resource.New(ctx, resource.WithFromEnv())

View File

@ -224,62 +224,6 @@ func NewMetrics(ctx context.Context, w io.Writer) (context.Context, func()) {
return ctx, func() {}
}
// NewMetrics embeds a metrics bus into the provided context. The bus can be
// utilized with calls like Inc and Since.
// func NewMetrics(ctx context.Context, w io.Writer) (context.Context, func()) {
// var (
// // report interval time-bounds metrics into buckets. Retention
// // controls how long each interval sticks around. Neither one controls
// // logging rates; that's handled by dumpMetrics().
// sink = metrics.NewInmemSink(reportInterval, retentionDuration)
// cfg = metrics.DefaultConfig("corso")
// sig = metrics.NewInmemSignal(sink, metrics.DefaultSignal, w)
// )
// cfg.EnableHostname = false
// cfg.EnableRuntimeMetrics = false
// gm, err := metrics.NewGlobal(cfg, sink)
// if err != nil {
// logger.CtxErr(ctx, err).Error("metrics bus constructor")
// sig.Stop()
// return ctx, func() {}
// }
// stop := make(chan struct{})
// go dumpMetrics(ctx, stop, sig)
// flush := func() {
// signalDump(ctx)
// time.Sleep(500 * time.Millisecond)
// close(stop)
// sig.Stop()
// gm.Shutdown()
// }
// // return context.WithValue(ctx, sinkCtxKey, sink), flush
// return ctx, flush
// }
// dumpMetrics runs a loop that sends a os signal (SIGUSR1 on linux/mac, SIGBREAK on windows)
// every logging interval. This syscall getts picked up by the metrics inmem signal and causes
// it to dump metrics to the provided writer (which should be the logger).
// Expectation is for users to call this in a goroutine. Any signal or close() on the stop chan
// will exit the loop.
// func dumpMetrics(ctx context.Context, stop <-chan struct{}, sig *metrics.InmemSignal) {
// tock := time.NewTicker(reportInterval)
// for {
// select {
// case <-tock.C:
// signalDump(ctx)
// case <-stop:
// return
// }
// }
// }
// Inc increments the given category by 1.
func Inc(cat metricsCategory, keys ...string) {
cats := append([]string{string(cat)}, keys...)