Commit Graph
7894 Commits
Author SHA1 Message Date
ZverGuy 3a5eb4fbf2 test(observability-proxy): cover stalled reviews on the application roots
Application roots take two access reviews before any body is read; a
POST to either must answer 503 within the request timeout when
kube-apiserver stalls on them.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 19dbee15fc docs(observability-proxy): explain why both application roots need the namespace root
The reason given for the second access review held only for the metrics
root. The log root needs it too, because an ownerless pod keeps the
lineage labels its creator set and can claim any application. The
tenant ClusterRole comment also named only the namespace roots, though
the application roots now depend on the same rule.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy e8e0cede61 fix(observability-proxy): forward the default instant query time
An instant query without time had its application lookup sized at the
proxy's clock, but the time was not forwarded, so vmselect evaluated at
its own later clock. With lookups taking most of the request deadline,
the evaluation lands well past the end of the lookup and leaves out pods
first sampled in between. Forward the instant the lookup was sized for.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 79ea8561de fix(observability-proxy): end a backquoted string only at an unescaped quote
The string tracking treated a backslash inside backquotes as literal,
but metricsql's scanString lets a backslash escape the closing quote
in all three quote kinds, and a quoted label name keeps that escape
({`\``=""} parses). The proxy ended such a string early, read the rest
of the query as string content, and accepted an escaped
rollup_candlestick after it with the lookup ending too soon.

Inside any quote a backslash now skips the next character, as
scanString does, and the comment no longer claims metricsql refuses
an escaped backquote.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy ac5a3c88c4 fix(observability-proxy): put the latency window in the instant start
The second latency offset was added to the application lookup only,
so the other readers of the instant query's earliest read still
assumed time minus 30s: the store choice could send a query to the
short-term store up to 30 seconds too late near its retention edge,
the lookback cap compared against a start the lookup no longer used,
and the field no longer meant the earliest instant read.

The earliest read of an instant query now starts from time minus two
latency offsets, the earliest instant vmselect can evaluate it at, and
the lookup uses it as is.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy cf45a23bf3 fix(observability-proxy): refuse comments outside strings on the app root
The escape check tracked string literals but not comments: in
metricsql a "#" outside a string comments out the rest of the line, so
a quote inside a comment made the check treat the next line's code as
string content, and rollup\_candlestick there was accepted again. The
bracket and offset scans do not understand comments either.

A "#" outside a string now makes the lookahead unknown as well, which
answers 422 on the application root, rather than teaching every scan
about comments; API clients do not send them.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy a54760fd9c fix(observability-proxy): start the instant app lookup a latency early
vmselect evaluates an instant query whose time is within 30s of its
own clock at that clock minus 30s (queryOffset in prometheus.go), not
at time minus 30s. For a time slightly in the future the evaluation
starts earlier than the proxy assumed: time=now+29s with a 1s step
read from six minutes before, while the lookup started at five
minutes 32 seconds, and pods present only in that gap were missing
from a 200.

The evaluation instant is always within (time-60s, time], so the
lookup of an instant query now starts one more latency offset early.
That needs no assumption about the proxy's clock matching vmselect's.
The store choice on the namespace root is left as it is.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 3198de893a fix(observability-proxy): refuse escapes outside strings on the app root
metricsql unescapes identifiers (unescapeIdent in parser.go), so
rollup\_candlestick(x + y) is rollup_candlestick to vmselect while the
lexical scan saw another name: the lookup ended ten minutes past the
evaluation time and vmselect read nearly thirteen. Any escaped keyword
the scan looks for, offset included, had the same hole. A backslash
outside a string literal now makes the scan unknown, which answers 422
on the application root; escapes inside label values are unaffected.

With rollup_candlestick refused, two steps per "(" stay enough: a
subquery evaluates at most one step past its end plus the alignment of
that end to the step (evalRollupFuncWithSubquery), and the one step a
candlestick over a non-selector would add on top cannot occur.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 8e491d15dd fix(observability-proxy): accept only a token end after an offset
metricsql also reads a trailing $__interval as part of an offset's
duration: offset -1h$__interval is -(1h + step). The scan stopped at
the "$" and read one hour, so the lookup missed pods created in the
last step and the query answered 200 without them. Refusing a minus
alone left every other continuation open.

Only what certainly ends the duration token is now accepted after it:
whitespace, a closing bracket or separator, or a binary operator other
than minus; anything else answers 422 on the application root. The
grammar comment no longer claims upper-case offset units are refused,
as offsets are scanned lower-cased like metricsql reads them.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 054fac6ab0 docs(observability-proxy): name subquery steps in the app lookup texts
Since the lookup reaches subquery steps past the evaluation time, the
applicationScope comment still described only negative offsets, and a
query refused for a subquery step the scan cannot read got a 422 that
listed every other cause but that one.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy d164790946 test(observability-proxy): pin the subquery lookahead exactly
The subquery sizing was tested only as "at least two hours", so which
step drives it, the fallback to the query step for an empty subquery
step, and its refusals (an unreadable step, an unclosed bracket, a sum
past the duration range) were not held by any test.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy b876368a3f fix(observability-proxy): refuse any minus right after an offset again
Telling a compound duration from a subtraction by a duration-part
pattern missed forms metricsql accepts after the minus: offset 5m-1.h
is 55 minutes forward and offset 5m-.5h is 25, yet both read as five
minutes back, and the lookup silently missed pods created in between.
A pattern that followed scanSingleDuration exactly would still be a
second copy of the grammar to keep in step, so any minus right after
an offset's duration is refused again; offset 1h-1 and offset 5m-y now
answer 422 as well, and metricsql cannot parse the latter anyway.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 56fc64575a fix(observability-proxy): read a minus after an offset as an operator
The compound-offset refusal took any minus right after an offset's
duration for a compound, so x offset 1h-1 or x offset 5m-y answered
422. metricsql continues a duration token only with a minus followed
by a duration part (scanSingleDuration), so only that form is refused
now; anything else is the subtraction it is.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 84f19e14d8 fix(observability-proxy): reach the subquery steps in the app lookup
vmselect evaluates a subquery up to its end plus one subquery step,
rounded up to the step (evalRollupFuncWithSubquery in
app/vmselect/promql/eval.go), and range_* transforms (setLastValues)
and keep_next_value carry those later values back onto earlier points.
A series that starts after the evaluation time, such as a pod created
within that reach, can therefore appear in the answer, which the
earlier claim that only rollup_candlestick reads ahead missed. The
lookup stopped at the evaluation time and left such a pod out of a 200.

The lookahead now adds two steps per subquery level, counting every
"(" as a possible implicit subquery and using the largest step seen,
as the lookback already does. Overreaching only widens the lookup over
the application's own pods.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy cb35399ee7 fix(observability-proxy): refuse rollup_candlestick on the app root
vmselect evaluates rollup_candlestick one step ahead of the evaluation
time, with no offset in the query: evalRollupFuncWithoutAt adds the
step in effect to the window's start and end (app/vmselect/promql/
eval.go in v1.136.0-cluster, unchanged in v1.139.0). The lookahead
scan returned zero for it, so the lookup stopped at the evaluation time
and pods created during that step were left out of a 200.

The step in effect is the subquery's when the call is nested, so
rather than size it the application root answers 422. No other
function reads ahead: the subquery evaluation past its end in
evalRollupFuncWithSubquery is outside the outer rollup's window.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 5418d6b40e fix(observability-proxy): refuse compound offsets on the app root
The offset scan read a duration up to its first sign and ignored the
rest. metricsql lexes 1h-30m as one duration and DurationValue makes
every part after the first negative one subtract, so offset -1h-30m
shifts samples 90 minutes forward while the scan covered 60, and
offset 1h-2h shifts them an hour forward while the scan counted it as
looking back. The pod and PVC lookup then missed pods created in the
gap and the query answered 200 without them.

A duration followed directly by a minus now makes the scan unknown,
which answers 422 on the application root. A plus or a spaced sign is
an operator after the offset in metricsql, not part of it, and is
still read.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 486f13dce6 docs(observability-proxy): name every query form the app 422 refuses
The refusal named only the @ modifier and non-literal offsets, but the
same answer covers an @ inside a label value and WITH with a negative
offset, so a client could not tell why such a query was refused.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 5fc9e5a0b9 fix(observability-proxy): pass on only the limit text of a lookup 422
The series-limit refusal of a lookup reached the client with all of
cluster vmselect's wrapping, and that context can name vmstorage
nodes, the leak the generic 502 had just closed for other errors. The
client now gets the message from the limit on.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 41e61cb288 fix(observability-proxy): keep store error text out of lookup answers
A store error other than the series limit was built into the lookup's
502 message, and that text can name vmstorage nodes and addresses.
The handler happened to replace the message before it reached the
client, but nothing held it there. The text now goes to the log only.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 0bb98ced05 fix(observability-proxy): say that every @ is refused on app roots
The lookahead scan let @ start() and @ end() through and the 422 named
them as allowed, but the lookback scan cannot bound any @, so every @
query was refused anyway, with a message pointing at forms that would
not pass. Both scans now treat any @ as unknown and the message says
so. The lookback-cap test now exercises the cap with a window just past
it rather than an @ query.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 501f0d98f7 docs(observability-proxy): drop the claimed link between two flag defaults
The comment said the application lookback default matches
--metrics-max-range, but nothing ties the two: changing the range
flag leaves the lookback where it is. It now gives only the reason
for the length.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy c9c02b2d52 test(observability-proxy): cover a store 504 on the app lookup
The lookup now passes a 504 from the store through, where it used to
answer 502, but only the 504 read from a 422 body was tested.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 336961d7cd docs(observability-proxy): put the store-call multiplier in the flag help
The note that an application metrics request makes three store calls
sat in a source comment, where an operator reading --help never sees
it. It is now part of the --rate-limit-per-user help text.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy caa4e8d0e3 fix(observability-proxy): keep only the series-limit 422 of a lookup
vmselect answers 422 to every error that carries no status of its own,
its query timeout and storage failures included, so passing every
lookup 422 through told the client to narrow a window when the store
was failing, and bypassed the 504 for a missed deadline.

Only vmselect's series-limit message stays a 422, with the message
taken from its JSON answer; its timeout becomes 504 and anything else
502. The request deadline is checked before the store's status.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 85fb98dd2c fix(observability-proxy): stop refusing ordinary app queries on lookback
With the lookback refusal, the 24h default turned common application
queries into 422: a day's increase, and month-long panels at the step
a dashboard picks for them. The lookback estimate is a loose upper
bound, made for the store choice, and counts every "(" as an implicit
subquery, so it far exceeds what such queries read.

The lookback is only the refusal threshold, since the lookup itself
spans the window the query reads, so its default now matches
--metrics-max-range. The chart passes it from values, so an operator
can tune it.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 86dddb447a docs(observability-proxy): note the store calls behind one app request
The per-user rate counts client requests, but an application metrics
request makes three store calls, so an operator sizing the rate
against store capacity needs to know the multiplier.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 1a3e1827ef fix(observability-proxy): pass a store 422 from the app lookup through
vmselect answers 422 when a label lookup exceeds its own series
limits. The application root turned that into a 502, which reads as a
broken store, while the client could have fixed it by narrowing the
window. The 422 and vmselect's message now reach the client.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 84d5b4ff0a fix(observability-proxy): require a positive application lookback
Every query reads some time before its window, at least the implicit
rollup window, so with the lookback refusal a zero
--metrics-app-lookback would turn every application metrics query
into a 422. It is now refused at startup instead.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 84665a42a7 fix(observability-proxy): refuse app queries that read past the lookup
The pod and PVC lookup never started earlier than --metrics-app-lookback
before the window. A query that read further back, such as rate(x[7d])
with the 24h default, or whose lookback is unknown (an @ modifier, WITH,
a step-multiple window), answered 200 without the series of pods that
existed only before the lookup start.

Such queries now answer 422 on the application root, matching how a
query whose latest sample cannot be covered is handled; the namespace
root has no lookup and still serves them.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy bc823b704e fix(observability-proxy): answer 504 to a lookup that misses the deadline
Only a deadline hit before the lookup's response headers was reported
as 504. When the store sent its headers and then stalled, the deadline
expired while the body was decoded, and the decode error came back as
a generic 502, so a slow store looked like a broken one.

The request deadline is now checked whichever step of the lookup it
cut, and both cases are covered by a test.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 66e2b99f09 fix(observability-proxy): reach the aligned end in the app lookup
vmselect rounds a range query's end up to a whole step before
evaluating it, so the last point can read samples up to one step past
the end the client sent. The pod and PVC lookup stopped at that end
and could miss a pod created within the last step.

The lookup end of a range query now adds one step.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 1a3517fa81 fix(observability-proxy): fail an application query whose lookup failed
When the pod or PVC lookup failed, its branch was dropped and the
query still answered 200, without the cAdvisor and volume series of
the application, so a store error showed up as an empty graph. That
is the same silently incomplete answer that a lookup over its cap is
refused for.

A failed lookup now fails the request: 504 when the store missed the
deadline, 502 otherwise.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 97a55a167b docs(observability-proxy): put the route review comments on their functions
Reviews was inserted between ResourceAttributes and its doc comment,
so go doc showed the ResourceAttributes text on Reviews, and that text
still called it the single review a route needs, which application
roots no longer are.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 07f4f187ce fix(observability-proxy): cover forward-shifted samples in the app lookup
The pod and PVC lookup of the application metrics root ended at the
evaluation time, but a negative offset reads samples after it. An
instant query evaluated two hours ago with "offset -1h" reads samples
from one hour ago, so a pod created in between was missing from the
scope and its series were dropped while the request succeeded.

The lookup now ends at the latest instant the query reads, its window
end plus the sum of its negative offsets. A query whose latest sample
cannot be bounded, an @ modifier other than start() or end() or an
offset that is not a plain duration, is refused with 422 on the
application root; the namespace root has no lookup and still serves
it.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy c4593d4c3e fix(observability-proxy): require namespace access on application roots
The application roots asked only for the application subresource. Their
pod and PVC branches select by namespace and name across the whole
lookup window, so a caller granted only application "a" received the
older series of application "b" whenever "b" had used one of the same
pod or PVC names. The lineage labels the scope rests on can also be set
by whoever creates an unowned pod.

Until the scope carries application identity on every branch, the
application roots also require read access to the namespace root, the
same review the namespace root asks. Every tenant role that reads
applications already holds it, so no current grant loses access; a
grant narrowed by resourceNames alone is refused instead of trusted.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy dd7116ea45 fix(observability-proxy): check the lookup cap before dropping empty names
The store cuts a lookup at the cap plus one value. Dropping empty
values first could bring such a cut list back under the cap and serve
it as complete, hiding the application's other pods without the 422
that asks for a shorter range.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy e6697ea4f1 test(observability-proxy): cover malformed pod lookups and the lookup window
An empty name in a lookup answer would turn the pod branch into a
pattern that matches every series without a pod label, widening the
application scope to the namespace; nothing pinned the guard against
it. Malformed answers must only drop their branch, and the lookup must
start at the query's own lookback, or at the configured limit when that
lookback is unknown.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy dcdf0adab3 feat(observability-proxy): serve the application metrics root
Graphs of one application need its series without the caller knowing
which pods and volumes it ran on. Exporter series carry the identity
the scrape class stamps, but cAdvisor and kubelet volume series do not,
so the scope ORs three branches: the identity, and the application's
pods and PVCs as kube-state-metrics labelled them over the window. Each
branch also carries the namespace, so the scope is never wider than the
namespace root.

The lookup reaches back by the query's own lookback, bounded by a flag,
so pods replaced inside an expression's range still count. A failed
lookup only drops its branch. A list over its cap answers 422 instead
of being truncated, which would hide series without saying so.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy 2f600d5354 feat(observability-proxy): serve the application logs root
A viewer of one application gets that application's lines without
writing a namespace query and filtering by hand, and a grant narrowed to
one application by resourceNames is honoured on every logs endpoint,
tail and the pickers included. The namespace filter stays and the
application's identity is ANDed next to it as a second stream filter,
so the result can only be narrower than the namespace root.

The plural is mapped to its kind only after the caller is authorized,
so an anonymous client cannot probe which applications exist, and the
proxy is not ready until the ApplicationDefinitions cache is.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy ecb5de6051 feat(observability-proxy): map application plurals to their kinds
Paths and RBAC name an application by its plural, while the lineage
labels that scope its logs and series carry the kind. The mapping comes
from ApplicationDefinitions, kept in one place so both application roots
scope by the same kind. A plural declared for two kinds is refused
rather than resolved by cache order.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:24 +07:00
ZverGuy b3288be903 test(observability-proxy): cite only sources the repository has
The flag defaults test named a design document that is not in the
repository as the origin of the cost limits; the limits stand on their
own as flag defaults.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 04:03:06 +07:00
ZverGuy 16bcaa447d test(observability-proxy): cover stalled reviews on the metrics root
The metrics handler shares the bounded review calls with the logs
handler; a POST to it with an unread body must answer 503 as well
rather than wait on a stalled kube-apiserver.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 03:56:27 +07:00
ZverGuy 41b3237c07 refactor(observability-proxy): state the keyword and duration tests positively
staticcheck flags the negated disjunctions; naming the duration
characters and spelling out both word boundaries reads the same way the
rule is stated.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 03:56:18 +07:00
ZverGuy 3e2472280e fix(observability-proxy): keep the vmselect timeout below the request's
An equal vmselect timeout still lost the race: the proxy's deadline
starts before the request reaches vmselect, so the proxy cut first
and answered 504 for a store within its time. The vmselect timeout
must now be strictly below a set request timeout, the flag help says
so, and tests pin the accepted side too, including no request timeout.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 03:56:18 +07:00
ZverGuy 0c5d1cd93f fix(observability-proxy): keep the vmselect timeout within the request's
The timeout forwarded to vmselect could be set longer than the proxy's
own request timeout. The proxy then cut a query vmselect was still
allowed to run and answered 504 for a store that was within its time.
Such a combination now stops the proxy at startup.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 03:56:18 +07:00
ZverGuy 89fbdb136f test(observability-proxy): cover the 1970 bound of metrics times
Only the upper half of the refused 1970..2262 range had a test, so
the lower check could be dropped unnoticed. vmselect clamps a time
before 1970 to 0, which would answer for a window other than the one
asked for.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 03:56:18 +07:00
ZverGuy 65944fcb79 fix(observability-proxy): send metrics times vmselect cannot misread
Times went to vmselect as "%d.%03d" unix seconds. vmselect reads a
number without "-" as a unix time whose unit it guesses from its size,
so a time in the first 24.8 days of 1970 arrived as a thousand times
as many seconds: a window the proxy checked as 8.8 days and 30 points
reached vmselect as 2001..2025 and 30000 points, and the label and
series APIs, which have no points check, scanned the whole retention.
Times past 2038 were read as microseconds.

Times now go out as RFC3339 with milliseconds, which vmselect parses
as a date and never as a guessed unit, and times outside 1970..2262,
which vmselect cannot hold as nanoseconds, are refused. A test repeats
vmselect's parsing of the exact strings the proxy sends.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 03:56:18 +07:00
ZverGuy ec251cbd3b test(observability-proxy): watch the metrics slot instead of probing
The metrics slow-body and stalled-client tests probed the slot with
requests of their own, which competed for the one slot under test and
made them fail at random, under one shuffle seed reliably. They now
read the limiter's slot count, as the logs tests do; 300 runs of the
test and 20 shuffled runs of the package pass.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 03:56:18 +07:00
ZverGuy d2feb9b7c2 test(observability-proxy): pin the metrics concurrency Retry-After value
The metrics concurrency test only checked that a Retry-After was
present, while the rate limit test pins its value, so a change to the
promised hint passed. It now expects the literal value.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 03:56:18 +07:00
ZverGuy 3a5bcf2567 fix(observability-proxy): send durations vmselect reads back exactly
vmselect reads step and timeout as float seconds multiplied by 1000
and truncated, so a step the proxy checked as 1001ms and sent as
"1.001" arrived as 1000ms. The points limit was then checked against
a coarser step than vmselect used: a limit of 11000 let 11010 points
through, and many steps between 1ms and 100000s were affected.

Durations are now written so that the truncation lands on the
milliseconds the limits were checked with: the shortest form when it
reads back exactly, otherwise with half a millisecond added. Step and
timeout share the formatter, and a sweep test mirrors vmselect's
parsing.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
2026-11-10 03:56:18 +07:00