Skip to content

Commit

Permalink
[Sessions] Update Sessions proto with newest changes (#10386)
Browse files Browse the repository at this point in the history
  • Loading branch information
samedson authored Oct 20, 2022
1 parent d01cda5 commit f092647
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 63 deletions.
4 changes: 2 additions & 2 deletions FirebaseSessions/ProtoSupport/Protos/sessions.options
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ firebase.appquality.sessions.ApplicationInfo.app_id type:FT_POINTER
firebase.appquality.sessions.ApplicationInfo.device_model type:FT_POINTER
firebase.appquality.sessions.ApplicationInfo.development_platform_name type:FT_POINTER
firebase.appquality.sessions.ApplicationInfo.development_platform_version type:FT_POINTER
firebase.appquality.sessions.ApplicationInfo.session_sdk_version type:FT_POINTER
firebase.appquality.sessions.AndroidApplicationInfo.package_name type:FT_POINTER
firebase.appquality.sessions.AndroidApplicationInfo.sdk_version type:FT_POINTER
firebase.appquality.sessions.AndroidApplicationInfo.version_name type:FT_POINTER
firebase.appquality.sessions.AppleApplicationInfo.bundle_short_version type:FT_POINTER
firebase.appquality.sessions.AppleApplicationInfo.sdk_version type:FT_POINTER
firebase.appquality.sessions.AppleApplicationInfo.mcc_mnc type:FT_POINTER
47 changes: 32 additions & 15 deletions FirebaseSessions/ProtoSupport/Protos/sessions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
// "wireless_android_play_playlog.NetworkConnectionInfo"
// 5. Any new proto fields of type string, repeated, or bytes must be specified
// in the sessions.options file as "type:FT_POINTER"
// 6. Remove any Lint comments (eg. IfChanged lines)
// 7. Remove any optional specifiers
//

syntax = "proto3";
Expand All @@ -33,6 +35,7 @@ package firebase.appquality.sessions;

// Contains the relevant information around an App Quality Session.
// See go/app-quality-unified-session-definition for more details.
// Next tag: 4
message SessionEvent {
// The type of event being reported.
EventType event_type = 1;
Expand All @@ -43,13 +46,15 @@ message SessionEvent {
}

// Enum denoting all possible session event types.
// Next tag: 2
enum EventType {
EVENT_UNKNOWN = 0;
EVENT_TYPE_UNKNOWN = 0;
// This event type is fired as soon as a new session begins.
EVENT_SESSION_START = 1;
SESSION_START = 1;
}

// Contains session-specific information relating to the event being uploaded.
// Next tag: 7
message SessionInfo {
// A globally unique identifier for the session.
string session_id = 1;
Expand All @@ -60,22 +65,25 @@ message SessionInfo {
string firebase_installation_id = 3;
// The device-reported timestamp at which the event occurred.
int64 event_timestamp_us = 4;
// Any sampling rate being applied to these events on device.
// 1.0 implies no sampling.
float sampling_rate = 5;

// The data collection status for each related SDK.
DataCollectionStatus data_collection_status = 6;
}

// Contains the data collection status for each related SDK.
// Next tag: 4
message DataCollectionStatus {
// The collection status of the FirePerf SDK.
DataCollectionState performance = 1;
// The collection status for the Crashlytics SDK.
DataCollectionState crashlytics = 2;
// Any sampling rate being applied to these events on device.
// 1.0 implies no sampling.
float session_sampling_rate = 3;
}

// Enum denoting all possible states for SDK data collection.
// Next tag: 6
enum DataCollectionState {
COLLECTION_UNKNOWN = 0;
// This product SDK is not present in this version of the app.
Expand All @@ -93,6 +101,7 @@ enum DataCollectionState {
}

// App-level information collected from the device.
// Next tag: 8
message ApplicationInfo {
// Commonly known as the GMP App Id
string app_id = 1;
Expand All @@ -102,6 +111,8 @@ message ApplicationInfo {
string development_platform_name = 3;
// The version of the development platform in use by the app. Eg. 2020.3.33f1
string development_platform_version = 4;
// The version of the Firebase-Sessions SDK in use
string session_sdk_version = 7;

oneof platform_info {
// App info relevant only to Android apps
Expand All @@ -120,11 +131,10 @@ message ApplicationInfo {
// - model
// - country
// - network_connection_info
// Next tag: 4
message AndroidApplicationInfo {
// The applications package name. Eg. com.google.search
string package_name = 1;
// The version of the Android Firebase-Sessions SDK in use
string sdk_version = 2;
// The version name as specified in the app's manifest
// https://developer.android.com/guide/topics/manifest/manifest-element#vname
string version_name = 3;
Expand All @@ -137,24 +147,31 @@ message AndroidApplicationInfo {
// - os_full_version
// - model
// - country
// Next tag: 6
message AppleApplicationInfo {
// The application's bundle id. Eg. com.google.search
string bundle_short_version = 1;
// The version of the Apple Firebase-Sessions SDK in use
string sdk_version = 2;
// Describes the network connectivity of the device
NetworkConnectionInfo network_connection_info = 3;
// Collects the OS running. Eg. iOS, iPadOs, tvOS, etc.
OsName os_name = 4;
// The mobile country code / mobile network code (MCC/MNC) of the device's
// SIM/home network (not the device's active network)
// e.g., 310004 for Verizon USA.
string mcc_mnc = 5;
}

// The name of the operating system on which the application is running.
// Currently Apple only.
enum OsName {
OS_NAME_UNKNOWN = 0;
OS_NAME_IOS = 1;
OS_NAME_IPAD_OS = 2;
OS_NAME_MAC_OS = 3;
OS_NAME_TV_OS = 4;
OS_NAME_WATCH_OS = 5;
UNKNOWN_OSNAME = 0;
MACOS = 1;
MACCATALYST = 2;
IOS_ON_MAC = 3;
IOS = 4;
TVOS = 5;
WATCHOS = 6;
IPADOS = 7;
// Indicates no data was provided by the device (old sdk, Android)
UNSPECIFIED = 8;
}
20 changes: 10 additions & 10 deletions FirebaseSessions/Protogen/nanopb/sessions.nanopb.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,44 +33,44 @@ const pb_field_t firebase_appquality_sessions_SessionEvent_fields[4] = {
PB_LAST_FIELD
};

const pb_field_t firebase_appquality_sessions_SessionInfo_fields[7] = {
const pb_field_t firebase_appquality_sessions_SessionInfo_fields[6] = {
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firebase_appquality_sessions_SessionInfo, session_id, session_id, 0),
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_SessionInfo, previous_session_id, session_id, 0),
PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_SessionInfo, firebase_installation_id, previous_session_id, 0),
PB_FIELD( 4, INT64 , SINGULAR, STATIC , OTHER, firebase_appquality_sessions_SessionInfo, event_timestamp_us, firebase_installation_id, 0),
PB_FIELD( 5, FLOAT , SINGULAR, STATIC , OTHER, firebase_appquality_sessions_SessionInfo, sampling_rate, event_timestamp_us, 0),
PB_FIELD( 6, MESSAGE , SINGULAR, STATIC , OTHER, firebase_appquality_sessions_SessionInfo, data_collection_status, sampling_rate, &firebase_appquality_sessions_DataCollectionStatus_fields),
PB_FIELD( 6, MESSAGE , SINGULAR, STATIC , OTHER, firebase_appquality_sessions_SessionInfo, data_collection_status, event_timestamp_us, &firebase_appquality_sessions_DataCollectionStatus_fields),
PB_LAST_FIELD
};

const pb_field_t firebase_appquality_sessions_DataCollectionStatus_fields[3] = {
const pb_field_t firebase_appquality_sessions_DataCollectionStatus_fields[4] = {
PB_FIELD( 1, UENUM , SINGULAR, STATIC , FIRST, firebase_appquality_sessions_DataCollectionStatus, performance, performance, 0),
PB_FIELD( 2, UENUM , SINGULAR, STATIC , OTHER, firebase_appquality_sessions_DataCollectionStatus, crashlytics, performance, 0),
PB_FIELD( 3, FLOAT , SINGULAR, STATIC , OTHER, firebase_appquality_sessions_DataCollectionStatus, session_sampling_rate, crashlytics, 0),
PB_LAST_FIELD
};

const pb_field_t firebase_appquality_sessions_ApplicationInfo_fields[7] = {
const pb_field_t firebase_appquality_sessions_ApplicationInfo_fields[8] = {
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firebase_appquality_sessions_ApplicationInfo, app_id, app_id, 0),
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_ApplicationInfo, device_model, app_id, 0),
PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_ApplicationInfo, development_platform_name, device_model, 0),
PB_FIELD( 4, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_ApplicationInfo, development_platform_version, development_platform_name, 0),
PB_ANONYMOUS_ONEOF_FIELD(platform_info, 5, MESSAGE , ONEOF, STATIC , OTHER, firebase_appquality_sessions_ApplicationInfo, android_app_info, development_platform_version, &firebase_appquality_sessions_AndroidApplicationInfo_fields),
PB_ANONYMOUS_ONEOF_FIELD(platform_info, 6, MESSAGE , ONEOF, STATIC , UNION, firebase_appquality_sessions_ApplicationInfo, apple_app_info, development_platform_version, &firebase_appquality_sessions_AppleApplicationInfo_fields),
PB_FIELD( 7, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_ApplicationInfo, session_sdk_version, apple_app_info, 0),
PB_LAST_FIELD
};

const pb_field_t firebase_appquality_sessions_AndroidApplicationInfo_fields[4] = {
const pb_field_t firebase_appquality_sessions_AndroidApplicationInfo_fields[3] = {
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firebase_appquality_sessions_AndroidApplicationInfo, package_name, package_name, 0),
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_AndroidApplicationInfo, sdk_version, package_name, 0),
PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_AndroidApplicationInfo, version_name, sdk_version, 0),
PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_AndroidApplicationInfo, version_name, package_name, 0),
PB_LAST_FIELD
};

const pb_field_t firebase_appquality_sessions_AppleApplicationInfo_fields[5] = {
PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firebase_appquality_sessions_AppleApplicationInfo, bundle_short_version, bundle_short_version, 0),
PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_AppleApplicationInfo, sdk_version, bundle_short_version, 0),
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, firebase_appquality_sessions_AppleApplicationInfo, network_connection_info, sdk_version, &NetworkConnectionInfo_fields),
PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, firebase_appquality_sessions_AppleApplicationInfo, network_connection_info, bundle_short_version, &NetworkConnectionInfo_fields),
PB_FIELD( 4, UENUM , SINGULAR, STATIC , OTHER, firebase_appquality_sessions_AppleApplicationInfo, os_name, network_connection_info, 0),
PB_FIELD( 5, BYTES , SINGULAR, POINTER , OTHER, firebase_appquality_sessions_AppleApplicationInfo, mcc_mnc, os_name, 0),
PB_LAST_FIELD
};

Expand Down
Loading

0 comments on commit f092647

Please sign in to comment.