Skip to content

Commit bcec3ef

Browse files
authored
feat(semantic-conventions): add 'EVENT_*' exports for event names (#5832)
1 parent b4a205e commit bcec3ef

File tree

10 files changed

+247
-2
lines changed

10 files changed

+247
-2
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{%- import 'docstring.ts.j2' as d %}
2+
/*
3+
* Copyright The OpenTelemetry Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
//-----------------------------------------------------------------------------------------------------------------
19+
// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/ts-experimental/events.ts.j2
20+
//-----------------------------------------------------------------------------------------------------------------
21+
22+
{% for event in ctx.events %}
23+
{{d.docstring(event, "event")}}
24+
export const EVENT_{{ event.name | screaming_snake_case }} = '{{event.name}}' as const;
25+
26+
{% endfor %}

scripts/semconv/templates/registry/ts-experimental/weaver.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ templates:
2727
metrics: .
2828
}
2929
application_mode: single
30+
- pattern: events.ts.j2
31+
file_name: "experimental_events.ts"
32+
filter: >
33+
semconv_signal("event"; {
34+
"exclude_stability": ["stable", "", null]
35+
})
36+
| sort_by(.name)
37+
| { events: . }
38+
application_mode: single
3039

3140
params:
3241
excluded_attributes: ["messaging.client_id"]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{%- import 'docstring.ts.j2' as d %}
2+
/*
3+
* Copyright The OpenTelemetry Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
//-----------------------------------------------------------------------------------------------------------
19+
// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/ts-stable/events.ts.j2
20+
//-----------------------------------------------------------------------------------------------------------
21+
22+
{% for event in ctx.events %}
23+
{{d.docstring(event, "event")}}
24+
export const EVENT_{{ event.name | screaming_snake_case }} = '{{event.name}}' as const;
25+
26+
{% endfor %}

scripts/semconv/templates/registry/ts-stable/weaver.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ templates:
1919
metrics: .
2020
}
2121
application_mode: single
22+
- pattern: events.ts.j2
23+
file_name: "stable_events.ts"
24+
filter: >
25+
semconv_signal("event"; {
26+
"stable_only": true
27+
})
28+
| sort_by(.name)
29+
| { events: . }
30+
application_mode: single
2231

2332
params:
2433
excluded_attributes: ["messaging.client_id"]

semantic-conventions/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ All notable changes to the semantic-conventions package will be documented in th
99

1010
### :rocket: Features
1111

12+
* feat: add `EVENT_*` exports for event names in Semantic Conventions [#5832](https://github.com/open-telemetry/opentelemetry-js/pull/5832) @trentm
13+
1214
### :bug: Bug Fixes
1315

1416
* fix: prioritize `esnext` export condition as it is more specific [#5458](https://github.com/open-telemetry/opentelemetry-js/pull/5458)

semantic-conventions/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ This package has 2 separate entry-points:
2323
Exported constants follow this naming scheme:
2424

2525
- `ATTR_${attributeName}` for attributes
26+
- `${attributeName}_VALUE_{$enumValue}` for enumerations of attribute values
2627
- `METRIC_${metricName}` for metric names
27-
- `${attributeName}_VALUE_{$enumValue}` for enumerations
28+
- `EVENT_${eventName}` for event names
2829

29-
The `ATTR`, `METRIC`, and `VALUE` static strings were used to facilitate readability and filtering in auto-complete lists in IDEs.
30+
The `ATTR`, `METRIC`, `EVENT`, and `VALUE` static strings were used to facilitate readability and filtering in auto-complete lists in IDEs.
3031

3132
## Usage
3233

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
//-----------------------------------------------------------------------------------------------------------------
18+
// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/ts-experimental/events.ts.j2
19+
//-----------------------------------------------------------------------------------------------------------------
20+
21+
/**
22+
* This event represents an instantaneous click on the screen of an application.
23+
*
24+
* @note The `app.screen.click` event can be used to indicate that a user has clicked or tapped on the screen portion of an application. Clicks outside of an application's active area **SHOULD NOT** generate this event. This event does not differentiate between touch/mouse down and touch/mouse up. Implementations **SHOULD** give preference to generating this event at the time the click is complete, typically on touch release or mouse up. The location of the click event **MUST** be provided in absolute screen pixels.
25+
*
26+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
27+
*/
28+
export const EVENT_APP_SCREEN_CLICK = 'app.screen.click' as const;
29+
30+
/**
31+
* This event indicates that an application widget has been clicked.
32+
*
33+
* @note Use this event to indicate that visual application component has been clicked, typically through a user's manual interaction.
34+
*
35+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
36+
*/
37+
export const EVENT_APP_WIDGET_CLICK = 'app.widget.click' as const;
38+
39+
/**
40+
* Deprecated. Use `azure.resource.log` instead.
41+
*
42+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
43+
*
44+
* @deprecated Replaced by `azure.resource.log`.
45+
*/
46+
export const EVENT_AZ_RESOURCE_LOG = 'az.resource.log' as const;
47+
48+
/**
49+
* Describes Azure Resource Log event, see [Azure Resource Log Top-level Schema](https://learn.microsoft.com/azure/azure-monitor/essentials/resource-logs-schema#top-level-common-schema) for more details.
50+
*
51+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
52+
*/
53+
export const EVENT_AZURE_RESOURCE_LOG = 'azure.resource.log' as const;
54+
55+
/**
56+
* This event describes the website performance metrics introduced by Google, See [web vitals](https://web.dev/vitals).
57+
*
58+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
59+
*/
60+
export const EVENT_BROWSER_WEB_VITAL = 'browser.web_vital' as const;
61+
62+
/**
63+
* This event represents an occurrence of a lifecycle transition on Android or iOS platform.
64+
*
65+
* @note The event body fields **MUST** be used to describe the state of the application at the time of the event.
66+
* 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).
67+
* 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.
68+
*
69+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
70+
*/
71+
export const EVENT_DEVICE_APP_LIFECYCLE = 'device.app.lifecycle' as const;
72+
73+
/**
74+
* Defines feature flag evaluation as an event.
75+
*
76+
* @note A `feature_flag.evaluation` event **SHOULD** be emitted whenever a feature flag value is evaluated, which may happen many times over the course of an application lifecycle. For example, a website A/B testing different animations may evaluate a flag each time a button is clicked. A `feature_flag.evaluation` event is emitted on each evaluation even if the result is the same.
77+
*
78+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
79+
*/
80+
export const EVENT_FEATURE_FLAG_EVALUATION = 'feature_flag.evaluation' as const;
81+
82+
/**
83+
* This event describes the assistant message passed to GenAI system.
84+
*
85+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
86+
*/
87+
export const EVENT_GEN_AI_ASSISTANT_MESSAGE = 'gen_ai.assistant.message' as const;
88+
89+
/**
90+
* This event describes the Gen AI response message.
91+
*
92+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
93+
*/
94+
export const EVENT_GEN_AI_CHOICE = 'gen_ai.choice' as const;
95+
96+
/**
97+
* This event describes the system instructions passed to the GenAI model.
98+
*
99+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
100+
*/
101+
export const EVENT_GEN_AI_SYSTEM_MESSAGE = 'gen_ai.system.message' as const;
102+
103+
/**
104+
* This event describes the response from a tool or function call passed to the GenAI model.
105+
*
106+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
107+
*/
108+
export const EVENT_GEN_AI_TOOL_MESSAGE = 'gen_ai.tool.message' as const;
109+
110+
/**
111+
* This event describes the user message passed to the GenAI model.
112+
*
113+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
114+
*/
115+
export const EVENT_GEN_AI_USER_MESSAGE = 'gen_ai.user.message' as const;
116+
117+
/**
118+
* Describes a message sent or received within the context of an RPC call.
119+
*
120+
* @note In the lifetime of an RPC stream, an event for each message sent/received on client and server spans **SHOULD** be created. In case of unary calls only one sent and one received message will be recorded for both client and server spans.
121+
*
122+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
123+
*/
124+
export const EVENT_RPC_MESSAGE = 'rpc.message' as const;
125+
126+
/**
127+
* Indicates that a session has ended.
128+
*
129+
* @note For instrumentation that tracks user behavior during user sessions, a `session.end` event **SHOULD** be emitted every time a session ends. When a session ends and continues as a new session, this event **SHOULD** be emitted prior to the `session.start` event.
130+
*
131+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
132+
*/
133+
export const EVENT_SESSION_END = 'session.end' as const;
134+
135+
/**
136+
* Indicates that a new session has been started, optionally linking to the prior session.
137+
*
138+
* @note For instrumentation that tracks user behavior during user sessions, a `session.start` event **MUST** be emitted every time a session is created. When a new session is created as a continuation of a prior session, the `session.previous_id` **SHOULD** be included in the event. The values of `session.id` and `session.previous_id` **MUST** be different.
139+
* When the `session.start` event contains both `session.id` and `session.previous_id` fields, the event indicates that the previous session has ended. If the session ID in `session.previous_id` has not yet ended via explicit `session.end` event, then the consumer **SHOULD** treat this continuation event as semantically equivalent to `session.end(session.previous_id)` and `session.start(session.id)`.
140+
*
141+
* @experimental This event is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
142+
*/
143+
export const EVENT_SESSION_START = 'session.start' as const;
144+

semantic-conventions/src/index-incubating.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818
// backward compatibility between minor version releases
1919
export * from './stable_attributes';
2020
export * from './stable_metrics';
21+
export * from './stable_events';
2122
export * from './experimental_attributes';
2223
export * from './experimental_metrics';
24+
export * from './experimental_events';

semantic-conventions/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ export * from './resource';
2626
// Use these instead
2727
export * from './stable_attributes';
2828
export * from './stable_metrics';
29+
export * from './stable_events';
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
//-----------------------------------------------------------------------------------------------------------
18+
// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/ts-stable/events.ts.j2
19+
//-----------------------------------------------------------------------------------------------------------
20+
21+
/**
22+
* This event describes a single exception.
23+
*/
24+
export const EVENT_EXCEPTION = 'exception' as const;
25+

0 commit comments

Comments
 (0)