Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
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

Description

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()
}

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions