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

Prometheus View of runtime.MemStats #784

@nfisher

Description

@nfisher

Motivation

I'm not sure if this belongs in this repo but I think there's some common runtime stats that most monitored services would want to expose similar to those available in /debug/pprof. I would see this feature being responsible for creating a measurement and view for each of the fields in the runtime.MemStats struct.

Impact

As this would be a new function this is an API expansion. The performance impact of adding this view is expected to be approximately equivalent to the cost of calling runtime.ReadMemStats and populating all of the measurements.

Proposed Implementation

Add a package go.opencensus.io/stats/view/runtime with the following functions and data structs;

  • New(prefix string) RuntimeViews.
  • RuntimeViews.Views() []View - returns a collection of all of the runtime views.
  • RuntimeViews.Start(freq uint64) - starts the background polling goroutine.
  • RuntimeViews.Stop() - stops the background polling goroutine.

param - prefix

  • Used to prefix each of the stats.

param - freq

  • Not sure if this is desirable or if it should make the ReadMemStats call on each request.
  • Idea would be to periodically call ReadMemStats in a background goroutine and cache the values until the timer has triggered.

return - []View

  • Each element in the []View would correspond to a field in the MemStats struct.
  • Descriptions would be the first line of each of the fields in the MemStats struct documentation.
  • The full names would be ${prefix}/runtime/${SNAKE_CASE_FIELD_NAME} (I'll map these out more fully later).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions