Skip to content

Commit e708533

Browse files
breedx-splktrasklmolkova
authored
Rework device events (#1880)
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com> Co-authored-by: Liudmila Molkova <limolkova@microsoft.com>
1 parent 61132ad commit e708533

File tree

13 files changed

+158
-102
lines changed

13 files changed

+158
-102
lines changed

.chloggen/1880.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
change_type: breaking
2+
component: mobile
3+
note: Rework `device.app.lifecycle` mobile event.
4+
issues: [1880]
5+
subtext: |
6+
The `device.app.lifecycle` event has been reworked to use attributes instead
7+
of event body fields. The `ios.app.state` and `android.app.state` attributes
8+
have been reintroduced to the attribute registry.

.github/ISSUE_TEMPLATE/bug_report.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ body:
6060
- area:heroku
6161
- area:host
6262
- area:http
63+
- area:ios
6364
- area:jvm
6465
- area:k8s
6566
- area:linux

.github/ISSUE_TEMPLATE/change_proposal.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ body:
5252
- area:heroku
5353
- area:host
5454
- area:http
55+
- area:ios
5556
- area:jvm
5657
- area:k8s
5758
- area:linux

docs/attributes-registry/android.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,30 @@ The Android platform on which the Android application is running.
1212

1313
| Attribute | Type | Description | Examples | Stability |
1414
|---|---|---|---|---|
15+
| <a id="android-app-state" href="#android-app-state">`android.app.state`</a> | string | This attribute represents the state of the application. [1] | `created` | ![Development](https://img.shields.io/badge/-development-blue) |
1516
| <a id="android-os-api-level" href="#android-os-api-level">`android.os.api_level`</a> | string | Uniquely identifies the framework API revision offered by a version (`os.version`) of the android operating system. More information can be found [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels). | `33`; `32` | ![Development](https://img.shields.io/badge/-development-blue) |
1617

18+
**[1] `android.app.state`:** The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.
19+
20+
---
21+
22+
`android.app.state` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
23+
24+
| Value | Description | Stability |
25+
|---|---|---|
26+
| `background` | Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state. | ![Development](https://img.shields.io/badge/-development-blue) |
27+
| `created` | Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time. | ![Development](https://img.shields.io/badge/-development-blue) |
28+
| `foreground` | Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states. | ![Development](https://img.shields.io/badge/-development-blue) |
29+
1730
## Deprecated Android Attributes
1831

1932
This document defines attributes that represents an occurrence of a lifecycle transition on the Android platform.
2033

2134
| Attribute | Type | Description | Examples | Stability |
2235
|---|---|---|---|---|
23-
| <a id="android-state" href="#android-state">`android.state`</a> | string | Deprecated use the `device.app.lifecycle` event definition including `android.state` as a payload field instead. [1] | `created`; `background`; `foreground` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `device.app.lifecycle`. |
36+
| <a id="android-state" href="#android-state">`android.state`</a> | string | Deprecated. Use `android.app.state` instead. [2] | `created`; `background`; `foreground` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Renamed to `android.app.state` |
2437

25-
**[1] `android.state`:** The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.
38+
**[2] `android.state`:** The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.
2639

2740
---
2841

docs/attributes-registry/ios.md

+27-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,40 @@
33

44
# iOS
55

6+
- [iOS Attributes](#ios-attributes)
7+
- [Deprecated iOS Attributes](#deprecated-ios-attributes)
8+
9+
## iOS Attributes
10+
11+
This group describes iOS-specific attributes.
12+
13+
| Attribute | Type | Description | Examples | Stability |
14+
|---|---|---|---|---|
15+
| <a id="ios-app-state" href="#ios-app-state">`ios.app.state`</a> | string | This attribute represents the state of the application. [1] | `active`; `inactive`; `background` | ![Development](https://img.shields.io/badge/-development-blue) |
16+
17+
**[1] `ios.app.state`:** The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate), and from which the `OS terminology` column values are derived.
18+
19+
---
20+
21+
`ios.app.state` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
22+
23+
| Value | Description | Stability |
24+
|---|---|---|
25+
| `active` | The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`. | ![Development](https://img.shields.io/badge/-development-blue) |
26+
| `background` | The app is now in the background. This value is associated with UIKit notification `applicationDidEnterBackground`. | ![Development](https://img.shields.io/badge/-development-blue) |
27+
| `foreground` | The app is now in the foreground. This value is associated with UIKit notification `applicationWillEnterForeground`. | ![Development](https://img.shields.io/badge/-development-blue) |
28+
| `inactive` | The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive`. | ![Development](https://img.shields.io/badge/-development-blue) |
29+
| `terminate` | The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`. | ![Development](https://img.shields.io/badge/-development-blue) |
30+
631
## Deprecated iOS Attributes
732

833
The iOS platform on which the iOS application is running.
934

1035
| Attribute | Type | Description | Examples | Stability |
1136
|---|---|---|---|---|
12-
| <a id="ios-state" href="#ios-state">`ios.state`</a> | string | Deprecated use the `device.app.lifecycle` event definition including `ios.state` as a payload field instead. [1] | `active`; `inactive`; `background` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Moved to a payload field of `device.app.lifecycle`. |
37+
| <a id="ios-state" href="#ios-state">`ios.state`</a> | string | Deprecated. use the `ios.app.state` instead. [2] | `active`; `inactive`; `background` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Renamed to `ios.app.state` |
1338

14-
**[1] `ios.state`:** The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate), and from which the `OS terminology` column values are derived.
39+
**[2] `ios.state`:** The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate), and from which the `OS terminology` column values are derived.
1540

1641
---
1742

docs/general/session.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ backends can link the two sessions (see [Session Start Event](#event-sessionstar
4040

4141
## Session Events
4242

43-
## Event: `session.start`
43+
### Event: `session.start`
4444

4545
<!-- semconv event.session.start -->
4646
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
@@ -70,7 +70,7 @@ When the `session.start` event contains both `session.id` and `session.previous_
7070
<!-- END AUTOGENERATED TEXT -->
7171
<!-- endsemconv -->
7272

73-
## Event: `session.end`
73+
### Event: `session.end`
7474

7575
<!-- semconv event.session.end -->
7676
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->

docs/mobile/events.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,30 @@ This event represents an occurrence of a lifecycle transition on Android or iOS
3939

4040
The event body fields MUST be used to describe the state of the application at the time of the event.
4141
This event is meant to be used in conjunction with `os.name` [resource semantic convention](/docs/resource/os.md) to identify the mobile operating system (e.g. Android, iOS).
42-
The `android.state` and `ios.state` fields are mutually exclusive and MUST NOT be used together, each field MUST be used with its corresponding `os.name` value.
42+
The `android.app.state` and `ios.app.state` fields are mutually exclusive and MUST NOT be used together, each field MUST be used with its corresponding `os.name` value.
4343

44-
**Body fields:**
45-
46-
| Body Field | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
44+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
4745
|---|---|---|---|---|---|
48-
| `android.state` | enum | This attribute represents the state the application has transitioned into at the occurrence of the event. [1] | `created` | `Conditionally Required` if and only if `os.name` is `android` | ![Development](https://img.shields.io/badge/-development-blue) |
49-
| `ios.state` | enum | This attribute represents the state the application has transitioned into at the occurrence of the event. [2] | `active` | `Conditionally Required` if and only if `os.name` is `ios` | ![Development](https://img.shields.io/badge/-development-blue) |
46+
| [`android.app.state`](/docs/attributes-registry/android.md) | string | This attribute represents the state of the application. [1] | `created` | `Conditionally Required` if and only if `os.name` is `android` | ![Development](https://img.shields.io/badge/-development-blue) |
47+
| [`ios.app.state`](/docs/attributes-registry/ios.md) | string | This attribute represents the state of the application. [2] | `active`; `inactive`; `background` | `Conditionally Required` if and only if `os.name` is `ios` | ![Development](https://img.shields.io/badge/-development-blue) |
48+
49+
**[1] `android.app.state`:** The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.
5050

51-
**[1]:** The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived.
51+
**[2] `ios.app.state`:** The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate), and from which the `OS terminology` column values are derived.
5252

53-
**[2]:** The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate), and from which the `OS terminology` column values are derived.
53+
---
5454

55-
`android.state` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
55+
`android.app.state` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
5656

5757
| Value | Description | Stability |
5858
|---|---|---|
5959
| `background` | Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state. | ![Development](https://img.shields.io/badge/-development-blue) |
6060
| `created` | Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time. | ![Development](https://img.shields.io/badge/-development-blue) |
6161
| `foreground` | Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states. | ![Development](https://img.shields.io/badge/-development-blue) |
6262

63-
`ios.state` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
63+
---
64+
65+
`ios.app.state` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
6466

6567
| Value | Description | Stability |
6668
|---|---|---|

model/android/deprecated/registry-deprecated.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ groups:
77
attributes:
88
- id: android.state
99
stability: development
10-
deprecated: "Replaced by `device.app.lifecycle`."
11-
brief: >
12-
Deprecated use the `device.app.lifecycle` event definition including
13-
`android.state` as a payload field instead.
10+
deprecated: "Renamed to `android.app.state`"
11+
brief: Deprecated. Use `android.app.state` instead.
1412
note: >
1513
The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc),
1614
and from which the `OS identifiers` are derived.

model/android/registry.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,31 @@ groups:
1313
(`os.version`) of the android operating system. More information can be found
1414
[here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels).
1515
examples: ['33', '32']
16+
- id: android.app.state
17+
stability: development
18+
brief: >
19+
This attribute represents the state of the application.
20+
note: >
21+
The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc),
22+
and from which the `OS identifiers` are derived.
23+
examples: [ "created" ]
24+
type:
25+
members:
26+
- id: created
27+
value: 'created'
28+
brief: >
29+
Any time before Activity.onResume() or, if the app has no Activity, Context.startService()
30+
has been called in the app for the first time.
31+
stability: development
32+
- id: background
33+
value: 'background'
34+
brief: >
35+
Any time after Activity.onPause() or, if the app has no Activity,
36+
Context.stopService() has been called when the app was in the foreground state.
37+
stability: development
38+
- id: foreground
39+
value: 'foreground'
40+
brief: >
41+
Any time after Activity.onResume() or, if the app has no Activity,
42+
Context.startService() has been called when the app was in either the created or background states.
43+
stability: development

model/device/events.yaml

+10-78
Original file line numberDiff line numberDiff line change
@@ -13,81 +13,13 @@ groups:
1313
[resource semantic convention](/docs/resource/os.md) to identify the
1414
mobile operating system (e.g. Android, iOS).
1515
16-
The `android.state` and `ios.state` fields are mutually exclusive and MUST
17-
NOT be used together, each field MUST be used with its corresponding
18-
`os.name` value.
19-
body:
20-
id: device_lifecycle_state
21-
type: map
22-
requirement_level: required
23-
stability: development
24-
fields:
25-
- id: ios.state
26-
stability: development
27-
requirement_level:
28-
conditionally_required: if and only if `os.name` is `ios`
29-
note: >
30-
The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate),
31-
and from which the `OS terminology` column values are derived.
32-
brief: >
33-
This attribute represents the state the application has transitioned into at the occurrence of the event.
34-
examples: ["active"]
35-
type: enum
36-
members:
37-
- id: active
38-
value: 'active'
39-
brief: >
40-
The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`.
41-
stability: development
42-
- id: inactive
43-
value: 'inactive'
44-
brief: >
45-
The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive`.
46-
stability: development
47-
- id: background
48-
value: 'background'
49-
brief: >
50-
The app is now in the background.
51-
This value is associated with UIKit notification `applicationDidEnterBackground`.
52-
stability: development
53-
- id: foreground
54-
value: 'foreground'
55-
brief: >
56-
The app is now in the foreground.
57-
This value is associated with UIKit notification `applicationWillEnterForeground`.
58-
stability: development
59-
- id: terminate
60-
value: 'terminate'
61-
brief: >
62-
The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`.
63-
stability: development
64-
- id: android.state
65-
stability: development
66-
requirement_level:
67-
conditionally_required: if and only if `os.name` is `android`
68-
brief: >
69-
This attribute represents the state the application has transitioned into at the occurrence of the event.
70-
note: >
71-
The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc),
72-
and from which the `OS identifiers` are derived.
73-
examples: ["created"]
74-
type: enum
75-
members:
76-
- id: created
77-
value: 'created'
78-
brief: >
79-
Any time before Activity.onResume() or, if the app has no Activity, Context.startService()
80-
has been called in the app for the first time.
81-
stability: development
82-
- id: background
83-
value: 'background'
84-
brief: >
85-
Any time after Activity.onPause() or, if the app has no Activity,
86-
Context.stopService() has been called when the app was in the foreground state.
87-
stability: development
88-
- id: foreground
89-
value: 'foreground'
90-
brief: >
91-
Any time after Activity.onResume() or, if the app has no Activity,
92-
Context.startService() has been called when the app was in either the created or background states.
93-
stability: development
16+
The `android.app.state` and `ios.app.state` fields are mutually
17+
exclusive and MUST NOT be used together, each field MUST be
18+
used with its corresponding `os.name` value.
19+
attributes:
20+
- ref: ios.app.state
21+
requirement_level:
22+
conditionally_required: if and only if `os.name` is `ios`
23+
- ref: android.app.state
24+
requirement_level:
25+
conditionally_required: if and only if `os.name` is `android`

model/ios/deprecated/registry-deprecated.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ groups:
77
attributes:
88
- id: ios.state
99
stability: development
10-
deprecated: "Moved to a payload field of `device.app.lifecycle`."
10+
deprecated: "Renamed to `ios.app.state`"
11+
brief: Deprecated. use the `ios.app.state` instead.
1112
note: >
1213
The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate),
1314
and from which the `OS terminology` column values are derived.
14-
brief: >
15-
Deprecated use the `device.app.lifecycle` event definition including
16-
`ios.state` as a payload field instead.
1715
type:
1816
members:
1917
- id: active

0 commit comments

Comments
 (0)