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

chore: add k8s job resources #6410

Merged
merged 1 commit into from
Nov 9, 2024
Merged

chore: add k8s job resources #6410

merged 1 commit into from
Nov 9, 2024

Conversation

srikanthccv
Copy link
Member

@srikanthccv srikanthccv commented Nov 8, 2024

Summary

Part of #5373


Important

Adds Kubernetes job metrics handling to the query service with new endpoints, models, and repository for job metrics queries.

  • Behavior:
    • Adds job metrics handling to APIHandler in http_handler.go with new endpoints for job attribute keys, values, and list.
    • Introduces JobsRepo in jobs.go for handling job metrics queries.
  • Models:
    • Adds JobListRequest, JobListResponse, and JobListRecord to model/infra.go.
  • Functions:
    • Adds getParamsForTopJobs() in common.go for job metrics aggregation.
    • Implements job metrics queries in JobsRepo in jobs.go.
  • Misc:
    • Updates infra.go to include job-related API handler functions.

This description was created by Ellipsis for 51df0c4. It will automatically update as commits are pushed.

@github-actions github-actions bot added the chore label Nov 8, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 51df0c4 in 1 minute and 20 seconds

More details
  • Looked at 662 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 9 drafted comments based on config settings.
1. pkg/query-service/app/infra.go:509
  • Draft comment:
    Consider providing more specific error messages for better debugging and user feedback.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code for handling job attribute keys and values is consistent with other similar functions. However, the error handling could be improved by providing more specific error messages.
2. pkg/query-service/app/infra.go:525
  • Draft comment:
    Consider providing more specific error messages for better debugging and user feedback.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code for handling job attribute keys and values is consistent with other similar functions. However, the error handling could be improved by providing more specific error messages.
3. pkg/query-service/app/infra.go:543
  • Draft comment:
    Consider providing more specific error messages for better debugging and user feedback.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code for handling job list is consistent with other similar functions. However, the error handling could be improved by providing more specific error messages.
4. pkg/query-service/app/inframetrics/common.go:89
  • Draft comment:
    Consider refactoring to avoid repetition across similar functions like getParamsForTopJobs, getParamsForTopHosts, etc.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The function getParamsForTopJobs is consistent with other similar functions. However, the code could be refactored to avoid repetition.
5. pkg/query-service/app/inframetrics/jobs.go:153
  • Draft comment:
    Consider providing more specific error messages for better debugging and user feedback.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The GetJobAttributeKeys function is consistent with other similar functions. However, the error handling could be improved by providing more specific error messages.
6. pkg/query-service/app/inframetrics/jobs.go:178
  • Draft comment:
    Consider providing more specific error messages for better debugging and user feedback.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The GetJobAttributeValues function is consistent with other similar functions. However, the error handling could be improved by providing more specific error messages.
7. pkg/query-service/app/inframetrics/jobs.go:364
  • Draft comment:
    Consider providing more specific error messages for better debugging and user feedback.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The GetJobList function is consistent with other similar functions. However, the error handling could be improved by providing more specific error messages.
8. pkg/query-service/app/inframetrics/jobs.go:369
  • Draft comment:
    Consider providing more specific error messages for better debugging and user feedback.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The GetJobList function is consistent with other similar functions. However, the error handling could be improved by providing more specific error messages.
9. pkg/query-service/app/http_handler.go:122
  • Draft comment:
    Do not add non-ClickHouse related functions to the ClickHouseReader interface. Use the DAO in the telemetry instance to access such information instead. This applies to the addition of jobsRepo and related methods.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment seems to be addressing a design concern about the ClickHouseReader interface, but the diff does not show any changes to the ClickHouseReader interface itself. The addition of 'jobsRepo' is related to inframetrics, not ClickHouseReader, so the comment might not be directly relevant to the changes made.
    I might be missing the context of how 'jobsRepo' interacts with ClickHouseReader, but based on the diff, there is no direct evidence of a change to ClickHouseReader.
    The comment might be preemptively addressing a potential design issue, but without evidence of a direct change to ClickHouseReader, it seems speculative.
    The comment does not seem directly relevant to the changes made in the diff, as there is no evidence of a change to ClickHouseReader. The comment should be deleted.

Workflow ID: wflow_YK7sUESKk2ziB763


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@srikanthccv srikanthccv changed the title chore: add k8s deployment resources chore: add k8s job resources Nov 8, 2024
Comment on lines +34 to +46
queryNamesForJobs = map[string][]string{
"cpu": {"A"},
"cpu_request": {"B", "A"},
"cpu_limit": {"C", "A"},
"memory": {"D"},
"memory_request": {"E", "D"},
"memory_limit": {"F", "D"},
"restarts": {"G", "A"},
"desired_pods": {"H"},
"active_pods": {"I"},
"failed_pods": {"J"},
"successful_pods": {"K"},
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename a, b, c, to some better query names
eg for kafka_fetch_latency I used "latency"
reason: code readability

},
}

jobQueryNames = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if someone also uses similar pattern, the whole codebase would become tricky to decode
A, B, C, ...... X1, X2, ...., AA1 etc namings are not conventional

@srikanthccv
Copy link
Member Author

I will change the query names for all in another PR.

@srikanthccv srikanthccv merged commit aa4a8df into add-statefulsets Nov 9, 2024
9 checks passed
@srikanthccv srikanthccv deleted the add-jobs branch November 9, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants