Repository navigation
Conversation
The metric families and their bound series move from InstanceState to ComponentState: the metrics are component-scoped, every instance writes the same pre-bound series. Instances keep only the counters they flush into those series, and registration no longer repeats on every instance start. k2-header.h is synced with the component-scoped contract.
The metrics API is available from k2_create_component onwards; calls from image-level entry points fail with EINVAL.
K2StringView/K2LabelPair become MetricLabelName/MetricLabelValue/ MetricLabel: a dedicated struct per role instead of one generic byte string, and "name" instead of "key" to match the monitoring system terminology. The k2-api wrappers and the diagnostics helpers follow; the contract doc block is updated to the new names and stays in sync with the k2-node header.
Shamzik
requested review from
PetrShumilov,
apolyakov and
denisichh
and removed request for
denisichh
October 13, 2026 14:14
apolyakov
reviewed
Oct 14, 2026
| * cases where the set of series is not known in advance. | ||
| * | ||
| * Contract (shared by all kinds): | ||
| * - the metrics API is available from `k2_create_component` onwards; |
Contributor
There was a problem hiding this comment.
The documentation is a bit misleading when it describes metrics lifecycle:
a component registers each metric once (at initialization)andthe metrics API is available fromk2_create_componentonwards. It looks like we allow metrics to be registered during instance init, for example
| * `k2_create_image`/`k2_init_image`) fail with `EINVAL`; | ||
| * - buckets are explicit upper boundaries; `buckets_size == 0` | ||
| * registers a histogram with a default bucket layout; | ||
| * - descriptors are valid until the component exits; there is no |
Contributor
There was a problem hiding this comment.
What do you mean by saying until the component exits?
Contributor
Author
There was a problem hiding this comment.
until ending of component's lifetime. Fixed description
| * - a kind mismatch (e.g. `k2_metrics_gauge_set` on a counter series) | ||
| * is rejected with `EINVAL`, as is an unknown descriptor. | ||
| * | ||
| * @param `md`/`sd` Out-pointers receiving the descriptor (0 on failure). |
Contributor
There was a problem hiding this comment.
They are not pointers only
Sync with the vkrs descriptor-api review fixes: registration is possible anywhere from k2_create_component onwards (not only at component initialization); descriptors are valid for the component's whole lifetime; md/sd are out-pointers only in the registration and bind functions, input values elsewhere. Co-Authored-By: Claude Code <noreply@anthropic.com>
denisichh
reviewed
Oct 15, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.