You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
arrayElement(ExplicitBounds, BucketLowIdx + 1) * intDivOrZero(Rank, CumRates[BucketLowIdx]))) as Rate
58
+
FROM HistRate) SELECT sum(
59
+
toFloat64OrNull(toString(Rate))
60
+
) FROM RawHist WHERE (TimeUnix >= fromUnixTimestamp64Milli(1739318400000) AND TimeUnix <= fromUnixTimestamp64Milli(1765670400000)) LIMIT 10"
61
+
`;
62
+
63
+
exports[`renderChartConfig should generate sql for a single sum metric 1`] =`
64
+
"WITH Source AS (
65
+
SELECT
66
+
*,
67
+
cityHash64(mapConcat(ScopeAttributes, ResourceAttributes, Attributes)) AS AttributesHash,
68
+
IF(AggregationTemporality = 1,
69
+
SUM(Value) OVER (PARTITION BY AttributesHash ORDER BY AttributesHash, TimeUnix ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW),
70
+
deltaSum(Value) OVER (PARTITION BY AttributesHash ORDER BY AttributesHash, TimeUnix ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
71
+
) AS Value
72
+
FROM default.otel_metrics_sum
73
+
WHERE (TimeUnix >= toStartOfInterval(fromUnixTimestamp64Milli(1739318400000), INTERVAL 5 minute) - INTERVAL 5 minute AND TimeUnix <= toStartOfInterval(fromUnixTimestamp64Milli(1765670400000), INTERVAL 5 minute) + INTERVAL 5 minute) AND ((MetricName = 'db.client.connections.usage'))),Bucketed AS (
74
+
SELECT
75
+
toStartOfInterval(toDateTime(TimeUnix), INTERVAL 5 minute) AS \`__hdx_time_bucket2\`,
76
+
AttributesHash,
77
+
last_value(Source.Value) AS \`__hdx_value_high\`,
78
+
any(\`__hdx_value_high\`) OVER(PARTITION BY AttributesHash ORDER BY \`__hdx_time_bucket2\` ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS \`__hdx_value_high_prev\`,
79
+
\`__hdx_value_high\` - \`__hdx_value_high_prev\` AS Value,
80
+
any(ResourceAttributes) AS ResourceAttributes,
81
+
any(ResourceSchemaUrl) AS ResourceSchemaUrl,
82
+
any(ScopeName) AS ScopeName,
83
+
any(ScopeVersion) AS ScopeVersion,
84
+
any(ScopeAttributes) AS ScopeAttributes,
85
+
any(ScopeDroppedAttrCount) AS ScopeDroppedAttrCount,
86
+
any(ScopeSchemaUrl) AS ScopeSchemaUrl,
87
+
any(ServiceName) AS ServiceName,
88
+
any(MetricName) AS MetricName,
89
+
any(MetricDescription) AS MetricDescription,
90
+
any(MetricUnit) AS MetricUnit,
91
+
any(Attributes) AS Attributes,
92
+
any(StartTimeUnix) AS StartTimeUnix,
93
+
any(Flags) AS Flags,
94
+
any(AggregationTemporality) AS AggregationTemporality,
95
+
any(IsMonotonic) AS IsMonotonic
96
+
FROM Source
97
+
GROUP BY AttributesHash, \`__hdx_time_bucket2\`
98
+
ORDER BY AttributesHash, \`__hdx_time_bucket2\`
99
+
) SELECT avg(
100
+
toFloat64OrNull(toString(Value))
101
+
),toStartOfInterval(toDateTime(\`__hdx_time_bucket2\`), INTERVAL 5 minute) AS \`__hdx_time_bucket\` FROM Bucketed WHERE (\`__hdx_time_bucket2\` >= fromUnixTimestamp64Milli(1739318400000) AND \`__hdx_time_bucket2\` <= fromUnixTimestamp64Milli(1765670400000)) GROUP BY toStartOfInterval(toDateTime(\`__hdx_time_bucket2\`), INTERVAL 5 minute) AS \`__hdx_time_bucket\` ORDER BY toStartOfInterval(toDateTime(\`__hdx_time_bucket2\`), INTERVAL 5 minute) AS \`__hdx_time_bucket\` WITH FILL FROM toUnixTimestamp(toStartOfInterval(fromUnixTimestamp64Milli(1739318400000), INTERVAL 5 minute))
102
+
TO toUnixTimestamp(toStartOfInterval(fromUnixTimestamp64Milli(1765670400000), INTERVAL 5 minute))
0 commit comments