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

RHIROS-1327 - Adding support for report having more than 24hrs o… #122

Merged
merged 5 commits into from
Sep 11, 2023

Conversation

patilsuraj767
Copy link
Collaborator

…f data.

@kgaikwad
Copy link
Collaborator

kgaikwad commented Sep 7, 2023

@patilsuraj767 - could you update ticket ID to RHIROS-1327 in commit message as well as title.

Copy link
Collaborator

@kgaikwad kgaikwad left a comment

Choose a reason for hiding this comment

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

Added few inline suggestion.

internal/config/config.go Outdated Show resolved Hide resolved
internal/config/config.go Outdated Show resolved Hide resolved
internal/services/report_processor.go Outdated Show resolved Hide resolved
internal/services/report_processor.go Outdated Show resolved Hide resolved
internal/services/report_processor.go Show resolved Hide resolved
internal/utils/utils.go Show resolved Hide resolved
@patilsuraj767 patilsuraj767 changed the title Ref - #RHIROS-1307 Adding support for report having more than 24hrs o… Ref - #RHIROS-1327 Adding support for report having more than 24hrs o… Sep 8, 2023
@saltgen saltgen self-requested a review September 8, 2023 07:06
internal/utils/utils.go Show resolved Hide resolved
for _, chunk := range k8s_object_chunks {
usage_data_byte, err := kruize.Update_results(experiment_name, chunk)
if err != nil {
log.Error(err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you confirm what details present under err? Will it be sufficient for debugging?

If something went wrong/failure occurs for update_results api with certain chunk, there will be data loss. Am I correct?
If this is so, is it expected behavior?

Copy link
Contributor

Choose a reason for hiding this comment

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

Would a chunk identifier be useful here 🤔

## pseudocode
usage_data_byte, err := kruize.Update_results(experiment_name, chunk)
if err != nil {
       log.Error(err, experiment_name, chunk_serial)
}
...
...
chunk_serial += 1

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, along with unique identifier for resource, it is good to include chunk specific info. example - time duration

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes @kgaikwad if something went wrong/failure occurs for update_results api with certain chunk, there will be data loss but we cannot help it. example - if suppose kruize application is down then update_results api will fail and we cannot do anything here to stop further API requests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes are not dividing chunks based on time stamp, means it is not the case that every metrics in the chunk have the same time stamp. So I think timestamp cannot be the unique identifier.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes @kgaikwad if something went wrong/failure occurs for update_results api with certain chunk, there will be data loss but we cannot help it. example - if suppose kruize application is down then update_results api will fail and we cannot do anything here to stop further API requests.

In my opinion, we should think on such scenarios and come with handling to minimize data loss. May be not for this PR but it is better to do brainstorming around.

So I think timestamp cannot be the unique identifier.

Then could you please include experiment name and any field info that might be specific to that request? So it will be easy for identifying that this upload request not processed completely, data loss observed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added the experiment_name in the log and by default request_id will be getting logged with the every log message.

Copy link
Collaborator

@kgaikwad kgaikwad Sep 11, 2023

Choose a reason for hiding this comment

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

@patilsuraj767, for first part, could you add a backlog ticket so that it won't get ignored by time. Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

internal/utils/utils.go Show resolved Hide resolved
internal/services/report_processor.go Outdated Show resolved Hide resolved
for _, chunk := range k8s_object_chunks {
usage_data_byte, err := kruize.Update_results(experiment_name, chunk)
if err != nil {
log.Error(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would a chunk identifier be useful here 🤔

## pseudocode
usage_data_byte, err := kruize.Update_results(experiment_name, chunk)
if err != nil {
       log.Error(err, experiment_name, chunk_serial)
}
...
...
chunk_serial += 1

internal/services/report_processor.go Outdated Show resolved Hide resolved
internal/services/report_processor.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@kgaikwad kgaikwad left a comment

Choose a reason for hiding this comment

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

Not tested but codewise looks good to me.

@kgaikwad kgaikwad changed the title Ref - #RHIROS-1327 Adding support for report having more than 24hrs o… RHIROS-1327 - Adding support for report having more than 24hrs o… Sep 11, 2023
Copy link
Contributor

@saltgen saltgen left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @patilsuraj767!

@patilsuraj767
Copy link
Collaborator Author

Thank you @saltgen and @kgaikwad for the review.
Merging the PR.

@patilsuraj767 patilsuraj767 merged commit cb83d1e into RedHatInsights:main Sep 11, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants