Skip to content

ts,docs: Autogenerated metrics documentation #25765

@rmloveland

Description

@rmloveland

Is this a question, feature request, or bug report?

This is a feature request.

The Custom chart debug page in the UI allows the user to create time series graphs using (AFAICT) arbitrary metrics.

When writing the docs, I had to pull the metrics from the source code using heuristics like

$ grep -R --no-filename --after-context=3 'metric\.Metadata' ~/go/src/github.com/cockroachdb/cockroach

However, this produces a lot of noise, as some of the docstrings are computed using string concatenation of variables and so forth, or are used in tests, etc.

	MetaConnectionsIncomingGauge = metric.Metadata{
		Name: "gossip.connections.incoming",
		Help: "Number of active incoming gossip connections"}
	MetaConnectionsOutgoingGauge = metric.Metadata{
		Name: "gossip.connections.outgoing",
		Help: "Number of active outgoing gossip connections"}
	MetaConnectionsRefused = metric.Metadata{
		Name: "gossip.connections.refused",
		Help: "Number of refused incoming gossip connections"}
	MetaInfosSent = metric.Metadata{
		Name: "gossip.infos.sent",
		Help: "Number of sent gossip Info objects"}
	MetaInfosReceived = metric.Metadata{
		Name: "gossip.infos.received",
		Help: "Number of received gossip Info objects"}
	MetaBytesSent = metric.Metadata{
		Name: "gossip.bytes.sent",
		Help: "Number of sent gossip bytes"}
	MetaBytesReceived = metric.Metadata{
		Name: "gossip.bytes.received",
		Help: "Number of received gossip bytes"}
)
--
	set := makeNodeSet(3, metric.NewGauge(metric.Metadata{Name: ""}))
	if is.leastUseful(set) != 0 {
		t.Error("not expecting a node from an empty set")
	}
--
		metric.NewGauge(metric.Metadata{Name: "TODO(marc)", Help: "TODO(marc)"}))
	for node := range as.nodes {
		if filterFn(node) {
			avail.addNode(node)
--
	nodes := makeNodeSet(1, metric.NewGauge(metric.Metadata{Name: ""}))
	if !nodes.hasSpace() {
		t.Error("set should have space")
	}
--
	nodes := makeNodeSet(2, metric.NewGauge(metric.Metadata{Name: ""}))
	node := roachpb.NodeID(1)
	if nodes.hasNode(node) {
		t.Error("node wasn't added and should not be valid")
--
	nodes := makeNodeSet(2, metric.NewGauge(metric.Metadata{Name: ""}))
	node0 := roachpb.NodeID(1)
	node1 := roachpb.NodeID(2)
	nodes.addNode(node0)

...

The feature request is for some kind of machine-generated output that can be used to update the documentation - similar to docgen: add generator for all defined settings, but for metrics.

FEATURE REQUEST

  1. Does an issue already exist addressing this request? If yes, please add a 👍 reaction to the existing issue. If not, move on to step 2.

I couldn't find one using the search strings "docgen is:open" or "metrics is:open". It seems similar in spirit to ui: Clear contract for metrics provided by CockroachDB. I suppose that might be a prerequisite, but I leave that to those qualified to decide.

  1. Please describe the feature you are requesting, as well as your proposed use case for this feature.

The feature and proposed use case are both described above.

  1. Indicate the importance of this issue to you (blocker, must-have, should-have, nice-to-have). Are you currently using any workarounds to address this issue?

It's a nice-to-have for documentation. The workaround is to use the grep command above and do a fair amount of manual work to gather the data and get it into Markdown format (took ~45 minutes, ISTR).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-kv-tsRelating to time-series management.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)X-stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions