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

PoC: Telemetry for Data.read #12385

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open

Conversation

Akirathan
Copy link
Member

@Akirathan Akirathan commented Feb 28, 2025

Part of #12090

Pull Request Description

Add dummy telemetry logs to the Data.read component. Telemetry.log is heavily inspired by Standard.Base.Enso_Cloud.Internal.Audit_Log.

Important Notes

Tried that inside the staging environment:

Note that Telemetry.log uses $HOME/.enso/credentials file for getting the access token. And this file is created by the IDE. That is why you need to test it inside the Electron app, and not via browser.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@Akirathan Akirathan self-assigned this Feb 28, 2025
Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

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

Refactoring seems fine. Just try to increase encapsulation little bit.

/**
* @return JSON string representation of the log message.
*/
String payload();
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this slightly over engineered? Why have a type for LogMessage at all, when each object has toString()?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Isn't this slightly over engineered? Why have a type for LogMessage at all, when each object has toString()?

This is not a regular toString. Each log message in the API has some common JSON structure. IIRC the class encapsulates the common parts of that structure. Then the payload method converts the structure into a JSON string. But not any string is accepted and we still need this common logic for generating the JSON somewhere.

Copy link
Member

Choose a reason for hiding this comment

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

Do we have any documentation describing the structure of all the messages?

Each log message in the API has some common JSON structure

That's the most important API.

Whether the message content is obtained via payload() or toString() is a niché (but I still suggest to remove LogMessage in the long run).

Copy link
Member

Choose a reason for hiding this comment

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

Do we have any documentation describing the structure of all the messages?

I'm afraid we don't. When I was implementing it, I was reading the code of the endpoint that is parsing it to figure it out.

https://github.com/enso-org/cloud-v2/blob/main/src/lambdas/src/lambdas/logs/endpoints/remote.rs#L57-L73

@Akirathan Akirathan changed the title Generalize enso_cloud log API access PoC: Telemetry for Data.read Feb 28, 2025
@Akirathan Akirathan linked an issue Feb 28, 2025 that may be closed by this pull request
_ ->
file_obj = File.new path
if file_obj.is_directory then Error.throw (Illegal_Argument.Error "Cannot `read` a directory, use `Data.list`.") else
file_obj.read format on_problems
file_content = file_obj.read format on_problems
Telemetry.log "Data.read" "read from file" (Dictionary.from_vector [["path", file_obj.path]])
Copy link
Member

Choose a reason for hiding this comment

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

Sending home the file path might reveal customer internals we are not interested in. File size and mime type should be generic enough, however.

@Akirathan Akirathan marked this pull request as ready for review March 6, 2025 17:57
@Akirathan Akirathan added the CI: No changelog needed Do not require a changelog entry for this PR. label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telemetry Improvements
3 participants