Skip to content

Commit 320e10a

Browse files
fix: pass absolute time range to queryMetricsMeta
When --period specifies an absolute range (e.g. 2026-04-01..2026-05-01), timeRangeToApiParams returns {start, end} with no statsPeriod. Previously only statsPeriod was forwarded to queryMetricsMeta, causing it to silently fall back to 7d and potentially miss the target metric.
1 parent f645f2a commit 320e10a

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎src/commands/explore.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ export const exploreCommand = buildListCommand("explore", {
702702
},
703703
() =>
704704
queryMetricsMeta(org, {
705-
statsPeriod: metaParams.statsPeriod,
705+
...metaParams,
706706
project,
707707
})
708708
);

‎src/lib/api/discover.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ export async function queryMetricsMeta(
103103
orgSlug: string,
104104
options?: {
105105
statsPeriod?: string;
106+
start?: string;
107+
end?: string;
106108
project?: string;
107109
}
108110
): Promise<MetricMeta[]> {
@@ -116,7 +118,12 @@ export async function queryMetricsMeta(
116118
fields: ["metric.name", "metric.type", "metric.unit"],
117119
dataset: "metricsEnhanced",
118120
query,
119-
statsPeriod: options?.statsPeriod ?? "7d",
121+
statsPeriod:
122+
options?.start || options?.end
123+
? undefined
124+
: (options?.statsPeriod ?? "7d"),
125+
start: options?.start,
126+
end: options?.end,
120127
limit: 100,
121128
},
122129
100

0 commit comments

Comments
 (0)