Skip to content

Commit dbcbf9e

Browse files
authored
RDK-57197: Add Analytics sendEvent.appId and update documentation (#280)
1 parent 501e1b2 commit dbcbf9e

File tree

4 files changed

+121
-21
lines changed

4 files changed

+121
-21
lines changed

apis/Analytics/IAnalytics.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace Exchange {
4343
// @param cetList: List of CETs
4444
// @param epochTimestamp: Epoch timestamp of the event
4545
// @param uptimeTimestamp: Uptime timestamp of the event
46+
// @param appId: Durable App Id string
4647
// @param eventPayload: Payload of the event
4748

4849
virtual Core::hresult SendEvent(const string& eventName /* @in */,
@@ -52,6 +53,7 @@ namespace Exchange {
5253
IStringIterator* const& cetList /* @in */,
5354
const uint64_t epochTimestamp /* @in */,
5455
const uint64_t uptimeTimestamp /* @in */,
56+
const string& appId /* @in */,
5557
const string& eventPayload /* @in */ ) = 0;
5658
};
5759
}

docs/apis/AnalyticsPlugin.md

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ The table below lists configuration options of the plugin.
3636
| classname | string | Class name: *org.rdk.Analytics* |
3737
| locator | string | Library name: *libWPEFrameworkAnalytics.so* |
3838
| autostart | boolean | Determines if the plugin shall be started automatically along with the framework |
39+
| configuration | object | |
40+
| configuration.loggername | string | Logger name used by backend |
41+
| configuration.loggerversion | string | Logger version used by backend |
42+
| configuration?.eventsmap | string | <sup>*(optional)*</sup> Optional path to json file with array of mapped events name |
43+
| configuration.backendlib | string | Name of backend library |
3944

4045
<a name="Methods"></a>
4146
# Methods
@@ -46,13 +51,13 @@ Analytics interface methods:
4651

4752
| Method | Description |
4853
| :-------- | :-------- |
49-
| [sendEvent](#sendEvent) | Send event |
54+
| [sendEvent](#sendEvent) | Enqueue an event to be sent to the SIFT analytics backend |
5055

5156

5257
<a name="sendEvent"></a>
5358
## *sendEvent*
5459

55-
Send
60+
Enqueue an event to be sent to the SIFT analytics backend.
5661

5762
### Events
5863

@@ -71,4 +76,50 @@ No Events
7176
| params.cetList[#] | string | |
7277
| params?.epochTimestamp | integer | <sup>*(optional)*</sup> Timestamp for the START of this event, epoch time, in ms UTC |
7378
| params?.uptimeTimestamp | integer | <sup>*(optional)*</sup> Timestamp for the START of this event, uptime of the device, in ms. ONLY to be used when Time quality is not good |
74-
| params.eventPayload | object | The payload of the event |
79+
| params?.appId | string | <sup>*(optional)*</sup> Durable App ID string |
80+
| params.eventPayload | object | Custom payload of the event in JSON format. User defined colection of objects and keys. May be an empty object |
81+
| params.eventPayload.keyOrObject | string | User defined custom key or object |
82+
83+
### Result
84+
85+
| Name | Type | Description |
86+
| :-------- | :-------- | :-------- |
87+
| result | string | On success null will be returned |
88+
89+
### Example
90+
91+
#### Request
92+
93+
```json
94+
{
95+
"jsonrpc": "2.0",
96+
"id": 42,
97+
"method": "org.rdk.Analytics.sendEvent",
98+
"params": {
99+
"eventName": "app_summary",
100+
"eventVersion": "1.0.0",
101+
"eventSource": "epg",
102+
"eventSourceVersion": "1.0.0",
103+
"cetList": [
104+
"cet1"
105+
],
106+
"epochTimestamp": 1721906631000,
107+
"uptimeTimestamp": 35000,
108+
"appId": "app-id-app1",
109+
"eventPayload": {
110+
"keyOrObject": "value1"
111+
}
112+
}
113+
}
114+
```
115+
116+
#### Response
117+
118+
```json
119+
{
120+
"jsonrpc": "2.0",
121+
"id": 42,
122+
"result": "null"
123+
}
124+
```
125+

tools/json_generator/output/Analytics/Analytics.json

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"info": {
55
"title": "Analytics API",
66
"class": "Analytics",
7-
"description": "The `Analytics` plugin allows sending analytics events to dedicated backends."
7+
"description": "The `Analytics` plugin allows sending analytics events to dedicated backends. Currently the SIFT backend is supported."
88
},
99
"common": {
1010
"$ref": "../common/common.json"
@@ -48,18 +48,26 @@
4848
"type": "integer",
4949
"example": 35000
5050
},
51+
"appId":{
52+
"summary": "Durable App ID string",
53+
"type": "string",
54+
"example": "app-id-app1"
55+
},
5156
"eventPayload":{
52-
"summary": "The payload of the event",
57+
"summary": "Custom payload of the event in JSON format. User defined colection of objects and keys. May be an empty object",
5358
"type": "object",
54-
"example": {
55-
"key1": "value1",
56-
"key2": "value2"
59+
"properties": {
60+
"keyOrObject": {
61+
"summary": "User defined custom key or object",
62+
"type": "string",
63+
"example": "value1"
64+
}
5765
}
5866
}
5967
},
6068
"methods": {
6169
"sendEvent":{
62-
"summary": "Send event",
70+
"summary": "Enqueue an event to be sent to the SIFT analytics backend",
6371
"params": {
6472
"type":"object",
6573
"properties": {
@@ -84,6 +92,9 @@
8492
"uptimeTimestamp":{
8593
"$ref": "#/definitions/uptimeTimestamp"
8694
},
95+
"appId":{
96+
"$ref": "#/definitions/appId"
97+
},
8798
"eventPayload":{
8899
"$ref": "#/definitions/eventPayload"
89100
}
@@ -97,7 +108,9 @@
97108
]
98109
},
99110
"result": {
100-
"$ref": "#/common/result"
111+
"summary": "On success null will be returned",
112+
"type": "string",
113+
"example": "null"
101114
}
102115
}
103116
}
Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,47 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/rdkcentral/rdkservices/main/Tools/json_generator/schemas/plugin.schema.json",
3-
"info": {
4-
"title": "Analytics Plugin",
5-
"callsign": "org.rdk.Analytics",
6-
"locator": "libWPEFrameworkAnalytics.so",
7-
"status": "development",
8-
"description": "The `Analytics` plugin allows to send analytics events to dedicated backends."
9-
},
10-
"interface": {
11-
"$ref": "Analytics.json#"
12-
}
2+
"$schema":"https://raw.githubusercontent.com/rdkcentral/rdkservices/main/Tools/json_generator/schemas/plugin.schema.json",
3+
"info":{
4+
"title":"Analytics Plugin",
5+
"callsign":"org.rdk.Analytics",
6+
"locator":"libWPEFrameworkAnalytics.so",
7+
"status":"development",
8+
"description":"The `Analytics` plugin allows to send analytics events to dedicated backends"
9+
},
10+
"configuration":{
11+
"type":"object",
12+
"properties":{
13+
"configuration":{
14+
"type":"object",
15+
"properties":{
16+
"loggername":{
17+
"description":"Logger name used by backend",
18+
"type":"string"
19+
},
20+
"loggerversion":{
21+
"description":"Logger version used by backend",
22+
"type":"string"
23+
},
24+
"eventsmap":{
25+
"description":"Optional path to json file with array of mapped events name",
26+
"type":"string"
27+
},
28+
"backendlib":{
29+
"description":"Name of backend library",
30+
"type":"string"
31+
}
32+
},
33+
"required":[
34+
"loggername",
35+
"loggerversion",
36+
"backendlib"
37+
]
38+
}
39+
},
40+
"required":[
41+
"configuration"
42+
]
43+
},
44+
"interface":{
45+
"$ref":"Analytics.json#"
46+
}
1347
}

0 commit comments

Comments
 (0)