-
Notifications
You must be signed in to change notification settings - Fork 126
Feat: add SetDefaultEventParameters and have EventLog to take in a vector #1801
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
base: main
Are you sure you want to change the base?
Conversation
This brings the Android SDK into parity for C++.
This adds in the iOS setdefaulteventparameters. Along with that I will make the setdefaulteventparameters and logevent take in vector for the parameters.
Summary of ChangesHello @AustinBenoit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Firebase Analytics C++ SDK by adding the ability to set default event parameters that are automatically attached to all subsequent events. It also modernizes the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Summary of ChangesHello @AustinBenoit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Firebase Analytics C++ SDK by introducing the ability to define default event parameters that are automatically included with every logged event. It also improves the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Summary of ChangesHello @AustinBenoit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces the ability to set default event parameters in Firebase Analytics for Android and iOS, and enhances the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces SetDefaultEventParameters and a std::vector overload for LogEvent to the Analytics SDK. The implementations for Android, iOS, and the desktop stubs are well-structured. My review includes a few suggestions to enhance robustness and clarity: addressing a potential crash on Android by adding a null check, correcting a misleading error message on iOS, updating documentation in a public header file for accuracy, and expanding test coverage for the new functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces SetDefaultEventParameters and adds a std::vector overload for LogEvent to the Analytics SDK. The changes are implemented for Android and iOS, with stubs for desktop platforms. The implementation is mostly correct, but I've identified a JNI local reference leak on Android, a misleading error message on iOS, and an error in the API documentation. My review includes specific suggestions to address these issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces SetDefaultEventParameters for setting default parameters for all analytics events, and adds std::vector overloads for LogEvent and SetDefaultEventParameters for convenience. The implementations for Android and iOS are included, along with stub implementations for desktop.
My review includes feedback on improving test coverage for the new vector-based APIs, correcting a misleading error message in the iOS implementation, and fixing incorrect documentation for the new LogEvent overload. Overall, the changes are well-structured and implement the intended features.
| const firebase::analytics::Parameter kDefaultParameters[] = { | ||
| firebase::analytics::Parameter("default_parameter_double", 123.456), | ||
| firebase::analytics::Parameter("default_parameter_int", 4), | ||
| firebase::analytics::Parameter("default_parameter_str", "Hello World"), | ||
| }; | ||
|
|
||
| firebase::analytics::SetDefaultEventParameters( | ||
| kDefaultParameters, | ||
| sizeof(kDefaultParameters) / sizeof(kDefaultParameters[0])); | ||
| firebase::analytics::LogEvent("default_parameter_event"); | ||
| firebase::analytics::SetDefaultEventParameters(nullptr, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is a good start for SetDefaultEventParameters. However, this pull request also introduces new std::vector-based overloads for both SetDefaultEventParameters and LogEvent. It would be beneficial to add tests for these new overloads to ensure they work as expected.
For example, you could modify this test to use std::vector:
const std::vector<firebase::analytics::Parameter> kDefaultParameters = {
firebase::analytics::Parameter("default_parameter_double", 123.456),
firebase::analytics::Parameter("default_parameter_int", 4),
firebase::analytics::Parameter("default_parameter_str", "Hello World"),
};
firebase::analytics::SetDefaultEventParameters(kDefaultParameters);
firebase::analytics::LogEvent("default_parameter_event");
firebase::analytics::SetDefaultEventParameters({});bc5ee73 to
9f6c0ea
Compare
❌ Integration test FAILEDRequested by @AustinBenoit on commit 3ff89c1
Add flaky tests to go/fpl-cpp-flake-tracker |
Description
Feat: add SetDefaultEventParameters and have EventLog to take in a vector.
The SetDefaultEventParameters has been updated for iOS and Android. However the desktop implementation is only stubbed out. The SetDefaultEventParameters adds parameters that will be set on every event logged from the SDK, including automatic ones. The values passed in the parameters dictionary will be added to the dictionary of default event parameters. These parameters persist across app runs.
To make the SDK more modern EventLog and SetDefaultEventParameters will take in a vector of event parameters.
To ensure that the SetDefaultEventParameters works as expected the Parameters of type Double in the Android SDK has been updated to pass along a Double type to the Android implementation.
Testing
Test locally with both iOS and Android.
iOS:

Android:

Added in an integration test for SetDefaultEventParameters.
Type of Change
Place an
xthe applicable box:Notes
Release Notessection ofrelease_build_files/readme.md.