Skip to content
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

Support query stats #148

Open
yeya24 opened this issue Jan 12, 2023 · 5 comments
Open

Support query stats #148

yeya24 opened this issue Jan 12, 2023 · 5 comments

Comments

@yeya24
Copy link
Contributor

yeya24 commented Jan 12, 2023

The original promql engine has builtin support for query stats https://github.com/prometheus/prometheus/blob/main/util/stats/query_stats.go#L112.

It has mainly 2 parts: timings and samples.

// queryTimings with all query timers mapped to durations.
type queryTimings struct {
	EvalTotalTime        float64 `json:"evalTotalTime"`
	ResultSortTime       float64 `json:"resultSortTime"`
	QueryPreparationTime float64 `json:"queryPreparationTime"`
	InnerEvalTime        float64 `json:"innerEvalTime"`
	ExecQueueTime        float64 `json:"execQueueTime"`
	ExecTotalTime        float64 `json:"execTotalTime"`
}

type querySamples struct {
	TotalQueryableSamplesPerStep []stepStat `json:"totalQueryableSamplesPerStep,omitempty"`
	TotalQueryableSamples        int64      `json:"totalQueryableSamples"`
	PeakSamples                  int        `json:"peakSamples"`
}

// BuiltinStats holds the statistics that Prometheus's core gathers.
type BuiltinStats struct {
	Timings queryTimings  `json:"timings,omitempty"`
	Samples *querySamples `json:"samples,omitempty"`
}

It would be nice to support capturing those stats in this query engine.

@yeya24
Copy link
Contributor Author

yeya24 commented Jan 12, 2023

Since this query engine is different from the old engine in terms of the query execution stages, I feel we don't have to support query timings for now. But it would be nice to support query samples first.

@fpetkovski
Copy link
Collaborator

Can we solve this through #106 ?

@yeya24
Copy link
Contributor Author

yeya24 commented Jan 17, 2023

I think #106 has a larger scope than this one.
This issue is mainly to support Prometheus query stats in the engine because currently if I enable query stats the engine panics.

@fpetkovski
Copy link
Collaborator

Got it, makes sense.

@sahnib
Copy link

sahnib commented Feb 3, 2023

I would like to contribute to adding support for query stats in the engine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants