mirror of https://github.com/minio/minio.git
trace: Bootstrap to show the correct source line number (#16989)
This commit is contained in:
parent
9803f68522
commit
91b6fe1af3
|
@ -62,8 +62,8 @@ func (bs *bootstrapTracer) Empty() bool {
|
||||||
return empty
|
return empty
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *bootstrapTracer) Record(msg string) {
|
func (bs *bootstrapTracer) Record(msg string, skip int) {
|
||||||
source := getSource(2)
|
source := getSource(skip + 1)
|
||||||
bs.mu.Lock()
|
bs.mu.Lock()
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
bs.info[bs.idx] = bootstrapInfo{
|
bs.info[bs.idx] = bootstrapInfo{
|
||||||
|
|
|
@ -28,7 +28,7 @@ func TestBootstrap(t *testing.T) {
|
||||||
// Bootstrap events exceed bootstrap messages limit
|
// Bootstrap events exceed bootstrap messages limit
|
||||||
bsTracer := &bootstrapTracer{}
|
bsTracer := &bootstrapTracer{}
|
||||||
for i := 0; i < bootstrapMsgsLimit+10; i++ {
|
for i := 0; i < bootstrapMsgsLimit+10; i++ {
|
||||||
bsTracer.Record(fmt.Sprintf("msg-%d", i))
|
bsTracer.Record(fmt.Sprintf("msg-%d", i), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
traceInfos := bsTracer.Events()
|
traceInfos := bsTracer.Events()
|
||||||
|
@ -45,7 +45,7 @@ func TestBootstrap(t *testing.T) {
|
||||||
|
|
||||||
// Fewer than 4K bootstrap events
|
// Fewer than 4K bootstrap events
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
bsTracer.Record(fmt.Sprintf("msg-%d", i))
|
bsTracer.Record(fmt.Sprintf("msg-%d", i), 1)
|
||||||
}
|
}
|
||||||
events := bsTracer.Events()
|
events := bsTracer.Events()
|
||||||
if len(events) != 10 {
|
if len(events) != 10 {
|
||||||
|
|
|
@ -352,7 +352,7 @@ func configRetriableErrors(err error) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func bootstrapTrace(msg string) {
|
func bootstrapTrace(msg string) {
|
||||||
globalBootstrapTracer.Record(msg)
|
globalBootstrapTracer.Record(msg, 2)
|
||||||
|
|
||||||
if globalTrace.NumSubscribers(madmin.TraceBootstrap) == 0 {
|
if globalTrace.NumSubscribers(madmin.TraceBootstrap) == 0 {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue