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
Pyroscope: Send start/end with profile types query #77523
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appears to work nicely 👍
Will need to fix some tests though!
@bryanhuhta you will still need to add backend code to send start/end to Pyroscope |
I added backend code in Pyroscope to handle start/end in grafana/pyroscope#2617. Is there any other backend code I might need to consider? I got distracted with a few other things last week, I'm circling back now to get tests here fixed up and get this merged in. |
Hey yeah so we are getting the start and end time on the frontend and it seems to be already done in Pyroscope API, but the start/end from the frontend is not actually being used in the Pyroscope API call i.e. the start/end needs to be added to the Pyroscope backend code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public/app/plugins/datasource/grafana-pyroscope-datasource/datasource.ts
Outdated
Show resolved
Hide resolved
@@ -65,6 +65,8 @@ export function VariableQueryEditor(props: QueryEditorProps<PyroscopeDataSource, | |||
props.onChange({ ...props.query, profileTypeId: val }); | |||
} | |||
}} | |||
from={props.range?.from.valueOf() || Date.now().valueOf() - 1000 * 60 * 60 * 24} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we're going back a day here but providing start/end of 0 in <QueryEditor />
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copy-pasted this from the <LabelRow />
part, assuming we wanted similar behavior.
grafana/public/app/plugins/datasource/grafana-pyroscope-datasource/VariableQueryEditor.tsx
Lines 74 to 85 in 8e01744
<LabelRow | |
value={props.query.labelName} | |
datasource={props.datasource} | |
profileTypeId={props.query.profileTypeId} | |
onChange={(val) => { | |
if (props.query.type === 'labelValue') { | |
props.onChange({ ...props.query, labelName: val }); | |
} | |
}} | |
from={props.range?.from.valueOf() || Date.now().valueOf() - 1000 * 60 * 60 * 24} | |
to={props.range?.to.valueOf() || Date.now().valueOf()} | |
/> |
This is a regression I caused. I suspect it's stemming from this function being changed to take start/end: Lines 76 to 87 in 43da2ba
These start/end values might be props changing by callers, causing the grafana/public/app/plugins/datasource/grafana-pyroscope-datasource/QueryEditor/QueryEditor.tsx Line 28 in 43da2ba
grafana/public/app/plugins/datasource/grafana-pyroscope-datasource/VariableQueryEditor.tsx Line 139 in 43da2ba
Though, I'm not a React expert and that's only my current working theory. I do need to fix this before this PR is OK to merge. |
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
@bryanhuhta if the rerenders are because of the time range it's probably because if you use range |
After 97a55a0, this PR should be ready to go. We no longer make a series of queries as the time range changes slightly during page load. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing those remaining issues! LGTM 👍
What is this feature?
Adds
start
/end
when making aProfileTypes
query from Pyroscope.Why do we need this feature?
we need to pass
start
andend
to Pyroscope when asking for profile types in order to accommodate users that may either have not sent profiling data in a long time or have a change what kind profiling data they send. This allows Pyroscope to query the correct time window and return accurate data. Prior to this change, Pyroscope would only return whatever information was in the head block of the ingesters.Which issue(s) does this PR fix?:
Related: grafana/pyroscope#2230 (Fixes, but I don't want the auto close).
Special notes for your reviewer:
There is a PR to improve the
ProfileTypes
API and correctly handlestart
/end
parameters. (grafana/pyroscope#2617). This PR needs to be merged first.Please check that: