Skip to content

security: cache certificate expiration metrics as pointers#142682

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
angles-n-daemons:cert-metric-caching-by-pointer
Mar 13, 2025
Merged

security: cache certificate expiration metrics as pointers#142682
craig[bot] merged 1 commit intocockroachdb:masterfrom
angles-n-daemons:cert-metric-caching-by-pointer

Conversation

@angles-n-daemons
Copy link
Contributor

security: cache certificate expiration metrics as pointers

Changes in #130110 were added to add labelled ttl metrics to client certificates. It achieved this by changing the system which cached certificate expiries to cache on a composite struct of two metrics, rather than just an expiration metric.

The struct itself housed the metrics as inline values, rather than pointers, so updates were registered in the cached values only, and not the registry in which they were reporting. This means that updates to client certificate expirations would not be reflected by the ttl or expiration metrics.

This ticket modifies those elements so that they are not copied when they are pulled from the cache.

Fixes: #142681
Epic: CRDB-40209

Release note (bug fix): Fixes bug in client certificate expiration metrics.

@angles-n-daemons angles-n-daemons requested review from a team as code owners March 11, 2025 21:06
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These two lines are the significant changes in the PR.

Changes in cockroachdb#130110 were added to add labelled ttl metrics to
client certificates. It achieved this by changing the system
which cached certificate expiries to cache on a composite
struct of two metrics, rather than just an expiration
metric.

The struct itself housed the metrics as inline values,
rather than pointers, so updates were registered in the
cached values only, and not the registry in which they were
reporting. This means that updates to client certificate
expirations would not be reflected by the ttl or expiration
metrics.

This ticket modifies those elements so that they are not
copied when they are pulled from the cache.

Fixes: cockroachdb#142681
Epic: CRDB-40209

Release note (bug fix): Fixes bug in client certificate expiration metrics.
@angles-n-daemons angles-n-daemons force-pushed the cert-metric-caching-by-pointer branch from 0f3d1fc to 2e872e2 Compare March 12, 2025 15:52
Copy link
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained


a discussion (no related file):
:lgtm: thanks Brian. Do we need some backport labels before this gets merged?

@angles-n-daemons angles-n-daemons added backport-24.3.x Flags PRs that need to be backported to 24.3 backport-24.1.x Flags PRs that need to be backported to 24.1. labels Mar 13, 2025
@angles-n-daemons
Copy link
Contributor Author

ah yes, good reminder!

@angles-n-daemons
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 13, 2025

@craig craig bot merged commit 42b4638 into cockroachdb:master Mar 13, 2025
24 checks passed
@blathers-crl
Copy link

blathers-crl bot commented Mar 13, 2025

Based on the specified backports for this PR, I applied new labels to the following linked issue(s). Please adjust the labels as needed to match the branches actually affected by the issue(s), including adding any known older branches.


Issue #142681: branch-release-24.1, branch-release-24.3.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@blathers-crl
Copy link

blathers-crl bot commented Mar 13, 2025

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 2e872e2 to blathers/backport-release-24.1-142682: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 24.1.x failed. See errors above.


error setting reviewers, but backport branch blathers/backport-release-24.3-142682 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/142843/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. []

Backport to branch 24.3.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.3.x Flags PRs that need to be backported to 24.3 backport-failed v25.2.0-prerelease

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: updating client certificates does not update the corresponding child metric

4 participants