Skip to content

kv/kvclient: add distinct metric for each RPC method#46747

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
nvb:nvanbenschoten/arrayMetric
Jun 27, 2020
Merged

kv/kvclient: add distinct metric for each RPC method#46747
craig[bot] merged 3 commits intocockroachdb:masterfrom
nvb:nvanbenschoten/arrayMetric

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Mar 30, 2020

This commit adds a new counter metric for each of the 44 request methods. It then updates DistSender to track the use of these methods in their associated counters.

The goal of this is to provide observability into the types of RPCs that are being sent in a cluster. We've seen a few cases in the past month where a cluster was sending more local and remote RPCs than expected, and being able to easily see what operations these RPCs were performing would have been a significant help to debugging.

Release note (admin ui change): A collection of new metrics were added that track the method of requests that are sent as RPCs between nodes in a cluster. These metrics are named distsender.rpc.<method>.sent, with examples of <method> being "scan" and "conditionalput".

@nvb nvb requested review from ajwerner and andreimatei March 30, 2020 19:51
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Mar 30, 2020

These metrics already paid dividends in #46752.

@ajwerner
Copy link
Copy Markdown
Contributor

FWIW I'm a big fan of this. I'm also interested in adding this sort of counter on the server side.

nvb added 2 commits June 25, 2020 10:24
This was introduced all the way back in a1e027a, but was never
directly tested.

Release justification: testing only
This commit extends `AddMetricStruct` to process array types
and add all non-nil metrics in arrays to its registry.

This allows us to address a long-standing TODO where we used
an array to point to distinct fields in a MetricStruct. We
couldn't remove the fields because the array was ignored.
With this change, we're now able to address the TODO.

This commit sets up the next.

Release justification: metric change that only impacts
initialization-time logic.
@nvb nvb force-pushed the nvanbenschoten/arrayMetric branch from 6436f2c to 63fd40e Compare June 25, 2020 16:17
@nvb nvb changed the title [DNM] kv: add distinct metric for each RPC method kv/kvclient: add distinct metric for each RPC method Jun 25, 2020
This commit adds a new counter metric for each of the 44 request
methods. It then updates DistSender to track the use of these methods
in their associated counters.

The goal of this is to provide observability into the types of RPCs that
are being sent in a cluster. We've seen a few cases in the past month
where a cluster was sending more local and remote RPCs than expected,
and being able to easily see what operations these RPCs were performing
would have been a significant help to debugging.

Release note (admin ui change): A collection of new metrics were added
that track the method of requests that are sent as RPCs between nodes in
a cluster. These metrics are named `distsender.rpc.<method>.sent`, with
examples of `<method>` being "scan" and "conditionalput".
@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Jun 25, 2020

I'm also interested in adding this sort of counter on the server side.

Agreed. I'm surprised we have absolutely nothing for this. I opened #50660 to track this.

I've rebased this and removed the WIP label, since I'm also more convinced something like this should exist. PTAL!

Copy link
Copy Markdown
Contributor

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @andreimatei)

Copy link
Copy Markdown
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm_strong:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner)

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Jun 27, 2020

TFTRs!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jun 27, 2020

Build succeeded

@craig craig bot merged commit 141359d into cockroachdb:master Jun 27, 2020
@nvb nvb deleted the nvanbenschoten/arrayMetric branch June 30, 2020 20:31
miretskiy pushed a commit to miretskiy/cockroach that referenced this pull request Sep 7, 2023
Extend metric registry to allow metric slices to be used.
Prior to this change metric registry only alowed arrays.

Slices are treated identical to the arrays -- the values
are expanded, and each metric added to the registry.  The array
itself was not added.

From some historical archeological perspective, cockroachdb#46747 added
support for embedded metric Arrays.  My best read on this PR is
that it narrowly addressed the existing "TODOs", and avoided
doing anything extra (which is good!).  But it does not appear
that there is a fundamental reason why slices should not be supported
the same way.

Expic: None

Release note: None
miretskiy pushed a commit to miretskiy/cockroach that referenced this pull request Sep 8, 2023
Extend metric registry to allow metric slices to be used.
Prior to this change metric registry only alowed arrays.

Slices are treated identical to the arrays -- the values
are expanded, and each metric added to the registry.  The array
itself was not added.

From some historical archeological perspective, cockroachdb#46747 added
support for embedded metric Arrays.  My best read on this PR is
that it narrowly addressed the existing "TODOs", and avoided
doing anything extra (which is good!).  But it does not appear
that there is a fundamental reason why slices should not be supported
the same way.

Expic: None

Release note: None
wenyihu6 pushed a commit to wenyihu6/cockroach that referenced this pull request Jul 21, 2024
Extend metric registry to allow metric slices to be used.
Prior to this change metric registry only alowed arrays.

Slices are treated identical to the arrays -- the values
are expanded, and each metric added to the registry.  The array
itself was not added.

From some historical archeological perspective, cockroachdb#46747 added
support for embedded metric Arrays.  My best read on this PR is
that it narrowly addressed the existing "TODOs", and avoided
doing anything extra (which is good!).  But it does not appear
that there is a fundamental reason why slices should not be supported
the same way.

Expic: None

Release note: None

# Conflicts:
#	pkg/util/metric/registry.go
#	pkg/util/metric/registry_test.go
wenyihu6 pushed a commit to wenyihu6/cockroach that referenced this pull request Jul 23, 2024
Extend metric registry to allow metric slices to be used.
Prior to this change metric registry only alowed arrays.

Slices are treated identical to the arrays -- the values
are expanded, and each metric added to the registry.  The array
itself was not added.

From some historical archeological perspective, cockroachdb#46747 added
support for embedded metric Arrays.  My best read on this PR is
that it narrowly addressed the existing "TODOs", and avoided
doing anything extra (which is good!).  But it does not appear
that there is a fundamental reason why slices should not be supported
the same way.

Expic: None

Release note: None

# Conflicts:
#	pkg/util/metric/registry.go
#	pkg/util/metric/registry_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants