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

Investigate how to handle malformed log files #170

Closed
eliasyishak opened this issue Sep 28, 2023 · 1 comment
Closed

Investigate how to handle malformed log files #170

eliasyishak opened this issue Sep 28, 2023 · 1 comment
Assignees
Labels
package:unified_analytics type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@eliasyishak
Copy link
Contributor

eliasyishak commented Sep 28, 2023

I only noticed this when I accidentally typed invalid characters and saved it into the log file, but if the parser is not able to parse each row of the json file, the entire process will fail. As a result, anything that requires calling for analytics.logFileStats() will fail, which includes fetching available surveys.

Sample of what caused the error in my case below

{"client_id":"fe4a035b-bba8-4d4b-a651-ea213e9b8a2c","events":[{"name":"lint_usage_count","params":{"count":1,"name":"unnecessary_parenthesis"}}],"user_properties":{"session_id":{"value":1695847559001},"flutter_channel":{"value":null},"host":{"value":"macOS"},"flutter_version":{"value":"3.14.0-14.0.pre.518"},"dart_version":{"value":"3.2.0-199.0.dev"},"analytics_pkg_version":{"value":"4.0.0"},"tool":{"value":"vscode-plugins"},"local_time":{"value":"2023-09-27 16:46:01.831138 -0400"}}}
{"client_id":"fe4a035b-bba8-4d4b-a651-ea213e9b8a2c","events":[{"name":"lint_usage_count","params":{"count":4,"name":"prefer_final_fields"}}],"user_properties":{"session_id":{"value":1695847559001},"flutter_channel":{"value":null},"host":{"value":"macOS"},"flutter_version":{"value":"3.14.0-14.0.pre.373"},"dart_version":{"value":"3.2.0-174.0.dev"},"analytics_pkg_version":{"value":"3.1.0"},"tool":{"value":"vscode-plugins"},"local_time":{"value":"2023-09-27 16:46:01.866532 -0400"}}}
}}
{"client_id":"fe4a035b-bba8-4d4b-a651-ea213e9b8a2c","events":[{"name":"lint_usage_count","params":{"count":4,"name":"prefer_final_in_for_each"}}],"user_properties":{"session_id":{"value":1695847559001},"flutter_channel":{"value":null},"host":{"value":"macOS"},"flutter_version":{"value":"3.14.0-14.0.pre.373"},"dart_version":{"value":"3.2.0-174.0.dev"},"analytics_pkg_version":{"value":"3.1.0"},"tool":{"value":"vscode-plugins"},"local_time":{"value":"2023-09-27 16:46:01.902782 -0400"}}}

In the example above, the third line item is not a valid record, if we encounter something like this, the package should ignore the malformed line and have the malformed line get phased out on its own since we cap the number of records to store locally

@eliasyishak eliasyishak added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) package:unified_analytics labels Sep 28, 2023
@eliasyishak eliasyishak self-assigned this Sep 28, 2023
@eliasyishak
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:unified_analytics type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant