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

Memory statistics never collected unless UseDerivedCumulative is used #1295

Open
kfcss opened this issue Jun 7, 2023 · 0 comments
Open

Memory statistics never collected unless UseDerivedCumulative is used #1295

kfcss opened this issue Jun 7, 2023 · 0 comments
Labels

Comments

@kfcss
Copy link

kfcss commented Jun 7, 2023

Please answer these questions before submitting a bug report.

What version of OpenCensus are you using?

go.opencensus.io v0.23.0

What version of Go are you using?

1.18

What did you do?

Callled

runmetrics.Enable(runmetrics.RunMetricOptions{
		EnableCPU:            true,
		EnableMemory:         true,
	})

What did you expect to see?

That memory metrics were being updated

What did you see instead?

Memory metrics are NOT updated.

Additional context

I think the bug was created with the commit: 49838f2

Metrics are created here:

if options.EnableMemory {
switch options.UseDerivedCumulative {
case true:
producer.memStats, err = newMemStats(producer)
if err != nil {
return err
}
default:
producer.deprecatedMemStats, err = newDeprecatedMemStats(producer)
if err != nil {
return err
}
}
}

The problem is that p.deprecatedMemStats.read() is never called in func (p *producer) Read():

func (p *producer) Read() []*metricdata.Metric {
if p.memStats != nil {
p.memStats.read()
}
if p.cpuStats != nil {
p.cpuStats.read()
}
return p.reg.Read()
}

@kfcss kfcss added the bug label Jun 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant