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

[NA] Add info logs #242

Merged
merged 2 commits into from
Sep 16, 2024
Merged

[NA] Add info logs #242

merged 2 commits into from
Sep 16, 2024

Conversation

thiagohora
Copy link
Contributor

@thiagohora thiagohora commented Sep 13, 2024

Details

Many parts of the service were lacking basic info logs. This first iteration added a few basic logs; next, we may add more debug logs and any remaining relevant info logs.

Issues

Resolves #

Testing

Documentation

@thiagohora thiagohora requested a review from a team as a code owner September 13, 2024 16:25
@thiagohora thiagohora self-assigned this Sep 13, 2024
Copy link

@LifeXplorer LifeXplorer 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. Added few points to consider

@@ -251,10 +253,12 @@ private Mono<Project> getProjectByName(String projectName) {
}

private <T> Mono<T> failWithConflict(String error) {
log.info(error);

Choose a reason for hiding this comment

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

To avoid pollution, it may have sense to log only once by identifier (projectName) in case these requests may be frequent. Smth like we have in EM: https://github.com/comet-ml/comet-backend/blob/f287bed3cfa92ba502fdb1a5728cd2ca1e55dd9a/comet-utils/src/main/java/com/comet/utils/monitoring/ErrorReporter.java#L57

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Conflicts are constraint validation. I don't expect to have them very often, but we can consider this if the number increases considerably. I would just avoid adding it now if it is not necessary yet.

return Response.ok().entity(service.findById(id)).build();
String workspaceId = requestContext.get().getWorkspaceId();

log.info("Finding dataset by id '{}' on workspaceId '{}'", id, workspaceId);

Choose a reason for hiding this comment

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

A general Q: what is the default log level of the app? If we plan to log INFO level by default, do we have aproxiamate expectation of the logs volume that may be generated. If the volume is too big, can make sense to consider log.debug instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @LifeXplorer,

Yeah, the default is INFO; for now, we only add logs at the API level and for expected errors. I believe this is the minimum to allow us to troubleshoot in case of errors or unexpected behaviors. We are talking about 3 or 4 logs per request, which seems reasonable. We may add more debug-level logs soon, but for information, I believe those are relevant.

Copy link
Collaborator

Choose a reason for hiding this comment

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

These are legitimate INFO level logs in order to have insights on the normal application flow for debugging and operational purposes.

Copy link
Collaborator

@andrescrz andrescrz left a comment

Choose a reason for hiding this comment

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

Just stylish comments, but no blockers.

return Response.ok().entity(service.findById(id)).build();
String workspaceId = requestContext.get().getWorkspaceId();

log.info("Finding dataset by id '{}' on workspaceId '{}'", id, workspaceId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are legitimate INFO level logs in order to have insights on the normal application flow for debugging and operational purposes.

String workspaceId = requestContext.get().getWorkspaceId();

log.info("Finding datasets by '{}' on workspaceId '{}'", criteria, workspaceId);
DatasetPage datasetPage = service.find(page, size, criteria);
Copy link
Collaborator

Choose a reason for hiding this comment

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

For future reference, just be careful about not leaking sensitive data to the logs in objects like this criteria. In this particular case, it should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. I thought about it, but I assumed those were not sensitive

@@ -117,13 +144,12 @@ public Response update(final @PathParam("id") UUID id,
})
public Response deleteById(@PathParam("id") UUID id) {

var workspace = service.getWorkspaceId(id);

if (workspace == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Functional change here, looks fine but be careful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was a leftover from when we changed to filter instead of controller level auth.

@@ -51,6 +51,8 @@
import java.util.UUID;
import java.util.stream.Collectors;

import static com.comet.opik.api.Span.SpanPage;
import static com.comet.opik.api.Span.View;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: not a big fan of static imports in general. For this particular case, you won't know which View it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point; in the case of the view, it's a bit confusing. I will remove it.

@@ -27,7 +27,7 @@ public class ExperimentItemService {
private final @NonNull ExperimentService experimentService;
private final @NonNull DatasetItemDAO datasetItemDAO;

public Mono<Void> create(Set<ExperimentItem> experimentItems) {
public Mono<Void> create(@NonNull Set<ExperimentItem> experimentItems) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: non-null not needed, the call below already validates it.

@thiagohora thiagohora merged commit ac91bf0 into main Sep 16, 2024
2 checks passed
@thiagohora thiagohora deleted the thiagohora/add_logs branch September 16, 2024 10:27
jverre pushed a commit that referenced this pull request Sep 16, 2024
jverre added a commit that referenced this pull request Sep 16, 2024
* add docker compose and simple nginx confi for it

* Updated Opik documentation with new deployment options

* [NA] Add info logs (#242)

* [OPIK-91] [UX improvements] Implement the Experiment configuration section in the compare page (#252)

* Update docs

* Removed images

* Update to self-host documentation

---------

Co-authored-by: liyaka <liyak@comet.com>
Co-authored-by: Andres Cruz <andresc@comet.com>
Co-authored-by: Thiago dos Santos Hora <thiagoh@comet.com>
Co-authored-by: andrii.dudar <andriid@comet.com>
dsblank pushed a commit that referenced this pull request Oct 4, 2024
dsblank pushed a commit that referenced this pull request Oct 4, 2024
* add docker compose and simple nginx confi for it

* Updated Opik documentation with new deployment options

* [NA] Add info logs (#242)

* [OPIK-91] [UX improvements] Implement the Experiment configuration section in the compare page (#252)

* Update docs

* Removed images

* Update to self-host documentation

---------

Co-authored-by: liyaka <liyak@comet.com>
Co-authored-by: Andres Cruz <andresc@comet.com>
Co-authored-by: Thiago dos Santos Hora <thiagoh@comet.com>
Co-authored-by: andrii.dudar <andriid@comet.com>
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