-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Feat/7077 | Related metrics api #7149
base: feat/7080
Are you sure you want to change the base?
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.
❌ Changes requested. Reviewed everything up to 843d9e1 in 3 minutes and 1 seconds
More details
- Looked at
615
lines of code in9
files - Skipped
0
files when reviewing. - Skipped posting
11
drafted comments based on config settings.
1. pkg/query-service/app/metricsexplorer/summary.go:150
- Draft comment:
Dashboard info is obtained by marshalling then unmarshalling JSON; consider a direct transform to improve performance. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. pkg/query-service/app/summary.go:107
- Draft comment:
Check error when reading request body before reassigning r.Body. Re-reading may mask underlying errors. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. pkg/query-service/utils/format.go:340
- Draft comment:
Using math.Pow with float conversion in GetEpochNanoSecs can be brittle; consider an integer-based calculation. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. pkg/query-service/utils/format.go:156
- Draft comment:
Clean up the inline comment formatting in QuoteEscapedStringForContains; remove extra spaces in the URL reference. - Reason this comment was not posted:
Confidence changes required:40%
<= threshold50%
None
5. pkg/query-service/interfaces/interface.go:135
- Draft comment:
Ensure downstream callers adhere to the DAO pattern for any non-ClickHouse functions; the GetRelatedMetrics method addition appears appropriate. - Reason this comment was not posted:
Comment was on unchanged code.
6. pkg/query-service/utils/format.go:162
- Draft comment:
Remove extra space in the comment URL in QuoteEscapedStringForContains (e.g. "https: //clickhouse...") to improve clarity. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. pkg/query-service/utils/format.go:306
- Draft comment:
Document the rationale for truncating typeName by one character in GetClickhouseColumnName; the slicing (typeName[:len(typeName)-1]) is non-obvious. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. pkg/query-service/utils/format.go:262
- Draft comment:
Consider simplifying pointer dereferencing in getPointerValue using reflect.Indirect to cover all pointer cases in a generic way. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. pkg/query-service/utils/format.go:209
- Draft comment:
Instead of using fmt.Sprint and strings.Fields for formatting numeric slices in ClickHouseFormattedValue, consider iterating and formatting each element to preserve formatting control. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
10. pkg/query-service/utils/format.go:339
- Draft comment:
Clarify expected input units and scale in GetEpochNanoSecs; adding documentation about whether it expects seconds, milliseconds, etc. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
11. pkg/query-service/utils/format.go:187
- Draft comment:
Consider controlling the precision when formatting float values in ClickHouseFormattedValue to avoid overly long decimals. - Reason this comment was not posted:
Confidence changes required:50%
<= threshold50%
None
Workflow ID: wflow_O7TFifSVr06gMUPl
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
@@ -621,3 +621,97 @@ func GetDashboardsWithMetricName(ctx context.Context, metricName string) ([]map[ | |||
|
|||
return result, nil | |||
} | |||
|
|||
func GetDashboardsWithMetricNames(ctx context.Context, metricNames []string) (map[string][]map[string]string, *model.ApiError) { |
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.
Consider refactoring the existing GetDashboardsWithMetricName
function to use this more general version.
- function
GetDashboardsWithMetricName
(model.go)
// Here we're using 0.5 for each, but adjust as needed. | ||
finalScores := make(map[string]float64) | ||
for metric, scores := range relatedMetricsMap { | ||
finalScores[metric] = scores.NameSimilarity*0.5 + scores.AttributeSimilarity*0.5 |
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.
The weights (0.5 for name and attribute similarity) are hardcoded. Consider declaring them as constants for clarity and easier future adjustments.
Summary
Related metrics api
Related Issues / PR's
Important
Introduces a new API to fetch related metrics based on name and attribute similarity, with changes across multiple files to support this functionality.
GetRelatedMetrics
function toClickHouseReader
inreader.go
to fetch related metrics based on name and attribute similarity./api/v1/metrics/related
endpoint inhttp_handler.go
to expose related metrics API.RelatedMetricsRequest
,RelatedMetricsResponse
, andRelatedMetricsScore
tometrics_explorer/summary.go
.ParseRelatedMetricsParams
inparser.go
to parse request parameters for related metrics.GetRelatedMetrics
insummary.go
to compute and return related metrics.interfaces/interface.go
to includeGetRelatedMetrics
in theReader
interface.This description was created by
for 843d9e1. It will automatically update as commits are pushed.