Hi, I'm building a timeseries panel in the signoz ...
# support
a
Hi, I'm building a timeseries panel in the signoz dashboard, how do I access the time range macro? Thanks
s
Did you mean time range from the top left ? You can use
{{SIGNOZ_START_TIME}}
and
{{SIGNOZ_END_TIME}}
.
a
alright thanks
do you have a link to the doc for the macros?
s
These two are special variable but you can create custom variable following this https://signoz.io/docs/userguide/manage-variables/
a
ah great, thanks
A follow up question, can I display a string in the value panel?
While using clickhouse query, do we have to rename the column name? Thanks
s
No, there should be datetime column for x axis, float column for y axis and optional string attribute columns for different aggregation.
can I display a string in the value panel?
What’s the use case? Where do you get the string from?
a
I'm trying to display a tag from tagMap, I will group by that tag, sort by durationNano, and display that tag that is taking the most time on average.
By the way @Srikanth Chekuri I am getting
Error: API responded with 400 - template: clickhouse-query:13: function "SIGNOZ_START_TIME" not defined
s
How are you using it in query?
a
WHERE
date_exec >= {{SIGNOZ_START_TIME}}
AND date_exec <= {{SIGNOZ_END_TIME}}
date_exec is datetime
s
Ah sorry it should be
{{.SIGNOZ_START_TIME}}
and
{{.SIGNOZ_END_TIME}}
basically the go templating format.
a
sorry, it is still is not working
Error: API responded with 400 - encountered multiple errors: error in query-A: code: 62, message: Syntax error: failed at position 359 ('<') (line 13, col 22): <no value> AND date_exec <= <no value>. Expected one of: ANY, ALL, BETWEEN expression, string concatenation expression, list, delimited by operator of variable arity, additive expression, list, delimited by binary operators, INTERVAL operator expression, INTERVAL, TIMESTAMP operator expression, TIMESTAMP, DATE operator expression, DATE, multiplicative expression, unary expression...
s
Share the full query
a
SELECT
toStartOfMinute(date_exec) AS time,
avg(duration)
FROM
(
SELECT
toTimeZone(timestamp, 'America/Toronto') AS date_exec,
ROUND(durationNano / 1000000, 2) AS duration,
serviceName AS serviceName,
tagMap['graphql.operation.name'] AS op_name
FROM signoz_traces.durationSort ds
WHERE
date_exec >= {{.SIGNOZ_START_TIME}}
AND date_exec <= {{.SIGNOZ_END_TIME}}
AND name = 'graphql.execute'
AND op_name != ''
AND op_name != 'IntrospectionQuery'
AND serviceName = 'stage'
)
GROUP BY
time
ORDER BY time ASC WITH FILL STEP 60
s
Can you confirm if the request payload has these values
SIGNOZ_START_TIME
and
SIGNOZ_END_TIME
?
a
Sorry but how would I confirm that? I tried setting panel time preference to both global time and custom
s
quick huddle?
a
sure
s
You probably need to convert the epoch to datetime type.
a
yes, also I had to divide by 1000 first to convert it to epoch seconds first
a
@Allan Li Is this solved? Are you able to group by tag and sort by duration?
a
Yes it is good, thank you
Although there is one more question, can I display a string in the value panel?
a
@Srikanth Chekuri possible using promql? Or the query-builder also support this?
s
Query builder requires float values and promql can’t be used on traces tables, so I don’t think this can be done now.
a
Okay I see
Thanks though