-
Notifications
You must be signed in to change notification settings - Fork 121
Show context for logs not working properly, query not customizable #706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could you provide your original query and press copy generated SQL ? (press Show generated sql) |
@Slach Sure - the original query is above, repeated here for convenience: SELECT level || + ' ' || message, time, level, facility, node, facility || '-' || node as alias, id as traceId, class, level as logLevel
FROM fluent.distributed_idLogs
WHERE id = '$locator' Generated query: /* grafana dashboard=Locator Logs, user=397 */
SELECT level || + ' ' || message, time, level, facility, node, facility || '-' || node as alias, id as traceId, class, level as logLevel
FROM fluent.distributed_idLogs
WHERE id = '' |
Clarifying a few things:
|
Hey @alexrosenfeld10 Thanks for reporting this issue! undefined appears there in case of absent value for the Timestamp Column field in Query Settings, could you please confirm if it's empty in your case? |
@lunaticusgreen thanks - I did not. This now correctly fires off the request, but I still need to modify the query it generates, as the query is not performant /* grafana dashboard=Locator Logs, user=397 */
SELECT timestamp
FROM
(
SELECT
time,
LAST_VALUE(time) OVER(ORDER BY time ROWS BETWEEN CURRENT ROW AND 10 FOLLOWING) AS timestamp
FROM fluent.distributed_idLogs
WHERE message LIKE '%Thread%'
ORDER BY time
)
WHERE time = toDateTime64(1736292096141 / 1000, 3)
FORMAT JSON In order for this to perform I need to add an |
@alexrosenfeld10 query is not performant, cause original query also not performant
without |
@Slach no, the original query performance is fine, thanks to |
hm, @lunaticusgreen |
I would suggest that either the original query is used unmodified except for the time and row adjustments, or a way to customize the clauses is exposed |
Hi @Slach @lunaticusgreen wondering if there was any update here? Thanks |
@Slach I added a simple improvement to add a where clause to the context request, it should do the trick here |
Hi, I'm looking to report a bug and figure out if the query behind the "Show Context" button when looking at logs is customizable.
Looking at the source code, I don't think it is, but would like to ask in case it's on the roadmap. It'd be very useful. The methods in question are
generateQueryForTimestampBackward
andgenerateQueryForTimestampForward
.Specifically, the button I'm asking about is:

When I click this, the queries fail:
The query being run is:
Ideally I'd like to figure out two things:
undefined
is coming from. The query behind my panel isid = '$locator'
clause to the query, as without it, even if the query worked syntactically, it would be incredibly poor performance without filtering byid
.Thanks in advance for any help!
The text was updated successfully, but these errors were encountered: