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

feat:func to return Count of entities in registry table w/signoff #427

Closed
wants to merge 19 commits into from

Conversation

Jougan-0
Copy link
Contributor

@Jougan-0 Jougan-0 commented Dec 4, 2023

Description

This PR fixes #

Notes for Reviewers
This function returns the total count of entities in the registries table

Signed commits

  • Yes, I signed my commits.

@leecalcote leecalcote added the language/go Golang related label Dec 5, 2023
@leecalcote
Copy link
Member

leecalcote commented Dec 5, 2023

@VihasMakwana would you like to offer review on this PR? That would be helpful.

Copy link
Member

@VihasMakwana VihasMakwana left a comment

Choose a reason for hiding this comment

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

Apart from changes, LGTM.

Jougan-0 and others added 3 commits December 6, 2023 20:31
Co-authored-by: VihasMakwana <[email protected]>
Signed-off-by: Shlok Mishra <[email protected]>
Signed-off-by: Shlok Mishra <[email protected]>
Copy link
Member

@leecalcote leecalcote left a comment

Choose a reason for hiding this comment

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

One of the more important use cases to facilitate with these logs is that of when a model or any of its entities is not successful in registering. It's important to be able to give contributors and Meshery administrators as much information as possible about what model and what entity failed to import and why.

Please provide examples of how these logs facilitate the administrator's resolution in the face of these import failures.

Include a link to troubleshooting Docs?

@leecalcote
Copy link
Member

One of the more important use cases to facilitate with these logs is that of when a model or any of its entities is not successful in registering. It's important to be able to give contributors and Meshery administrators as much information as possible about what model and what entity failed to import and why.

Please provide examples of how these logs facilitate the administrator's resolution in the face of these import failures.

Include a link to troubleshooting Docs?

Be aware that both Meshery Server and its clients (Meshery UI and mesheryctl) stand to benefit from this logged information. When a user imports a model using either of these two clients, the clients should return similar information.

Jougan-0 and others added 4 commits December 6, 2023 23:10
@Jougan-0
Copy link
Contributor Author

Jougan-0 commented Dec 9, 2023

meshery/meshery#9564

Copy link
Member

@leecalcote leecalcote left a comment

Choose a reason for hiding this comment

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

I looked again:

meshery git:(regLog) make server
cd server; cd cmd; go mod tidy; \
	BUILD="v0.7.2-rc-1" \
	PROVIDER_BASE_URLS="https://meshery.layer5.io" \
	PORT=9081 \
	DEBUG=true \
	ADAPTER_URLS="localhost:10000 localhost:10001 localhost:10012" \
	APP_PATH="./apps.json" \
	go run main.go error.go;
# command-line-arguments
./main.go:286:7: log.Infof undefined (type "github.com/layer5io/meshkit/logger".Handler has no field or method Infof)
./main.go:287:41: undefined: meshmodel.NonImportModel
./main.go:289:8: log.Errorf undefined (type "github.com/layer5io/meshkit/logger".Handler has no field or method Errorf)
./main.go:294:48: undefined: meshmodel.RegisterAttempts
make: *** [server] Error 1

Be sure that the PR is building before requesting your next review.

@Jougan-0
Copy link
Contributor Author

One of the more important use cases to facilitate with these logs is that of when a model or any of its entities is not successful in registering. It's important to be able to give contributors and Meshery administrators as much information as possible about what model and what entity failed to import and why.

Please provide examples of how these logs facilitate the administrator's resolution in the face of these import failures.

Include a link to troubleshooting Docs?

We are using a logic of creating a file of registery_attempts.json that stores every entity that failed
file is present at
meshery/server/cmd/registery_attempts.json

@Jougan-0
Copy link
Contributor Author

One of the more important use cases to facilitate with these logs is that of when a model or any of its entities is not successful in registering. It's important to be able to give contributors and Meshery administrators as much information as possible about what model and what entity failed to import and why.
Please provide examples of how these logs facilitate the administrator's resolution in the face of these import failures.
Include a link to troubleshooting Docs?

We are using a logic of creating a file of registery_attempts.json that stores every entity that failed file is present at meshery/server/cmd/registery_attempts.json

This could be used by the contributors and administrators to resolve the issue related to that entity

@leecalcote
Copy link
Member

Ready for final review, @Jougan-0?

@Jougan-0
Copy link
Contributor Author

@leecalcote final changes suggested by uzair are left will finish it today

@Jougan-0 Jougan-0 changed the title feat:func to return Count of entities in registries table w/signoff feat:func to return Count of entities in registry table w/signoff Dec 19, 2023
models/meshmodel/registry/error.go Show resolved Hide resolved
models/meshmodel/registry/error.go Show resolved Hide resolved
models/meshmodel/registry/error.go Show resolved Hide resolved
models/meshmodel/registry/error.go Show resolved Hide resolved
@VihasMakwana
Copy link
Member

@leecalcote PR looks good, can you take a final look?

Copy link
Contributor

@MUzairS15 MUzairS15 left a comment

Choose a reason for hiding this comment

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

Can't we maintain the error and attempt count in the registration funcs itself?

@Jougan-0
Copy link
Contributor Author

Jougan-0 commented Dec 28, 2023

The registration is done as follows in the
https://github.com/meshery/meshery/blob/cfd822700dc4dcb7b4cafa9d3af593fee017cf31/server/meshmodel/helper.go#L163
so while it is being is registered if we have an error we pass the to the new function I created
I used this logic as the in components if the schema is empty it returned nil rather than error and for each component and relationship we register it's model so every time we register them if we found an error then we count with the error .
Hope this makes sense @MUzairS15

@Jougan-0 Jougan-0 mentioned this pull request Jan 3, 2024
1 task
@Jougan-0
Copy link
Contributor Author

Jougan-0 commented Jan 3, 2024

meshery/meshery#9829

return errors.New(ErrWritingRegisteryAttemptsCode, errors.Alert, []string{"Error writing RegisteryAttempts JSON data to file"}, []string{"Error writing RegisteryAttempts JSON data to file:", err.Error()}, []string{}, []string{})
}
func ErrRegisteringEntity(failedMsg string, hostName string) error {
return errors.New(ErrRegisteringEntityCode, errors.Alert, []string{fmt.Sprintf("The import process for a registrant %s encountered difficulties,due to which %s. Specific issues during the import process resulted in certain entities not being successfully registered in the table.", hostName, failedMsg)}, []string{fmt.Sprintf("For registrant %s %s", hostName, failedMsg)}, []string{"Could be because of empty schema or some issue with the json or yaml file"}, []string{"Check /server/cmd/registery_attempts.json for futher details"})
Copy link
Member

Choose a reason for hiding this comment

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

@Jougan-0 @MUzairS15 this directory will not be present in Meshery deployments. This log file needs to be stored under ~/.meshery/server/registry.log

Copy link
Member

@leecalcote leecalcote left a comment

Choose a reason for hiding this comment

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

The log file location needs to be available in Meshery deployments, not only in local builds. Our standard location for such files is ~/.meshery

Copy link

stale bot commented Mar 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue/stale Issue has not had any activity for an extended period of time label Mar 13, 2024
Copy link

stale bot commented Mar 23, 2024

This issue is being automatically closed due to inactivity. However, you may choose to reopen this issue.

@stale stale bot closed this Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/stale Issue has not had any activity for an extended period of time language/go Golang related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants