Skip to content

Commit 802ba4b

Browse files
authored
[mdatagen] Add docs for optional events (#13131)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Add documentation template for optional events. <!-- Issue number if applicable --> #### Link to tracking issue Part of #12571 <!--Describe what testing was performed and which tests were added.--> #### Testing n/a <!--Describe the documentation added.--> #### Documentation Added <!--Please delete paragraphs that you did not use before submitting.-->
1 parent e1f6708 commit 802ba4b

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

cmd/mdatagen/internal/samplereceiver/documentation.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,30 @@ The event will be removed soon.
141141
| slice_attr | Attribute with a slice value. | Any Slice |
142142
| map_attr | Attribute with a map value. | Any Map |
143143
144+
## Optional Events
145+
146+
The following events are not emitted by default. Each of them can be enabled by applying the following configuration:
147+
148+
```yaml
149+
events:
150+
<event_name>:
151+
enabled: true
152+
```
153+
154+
### default.event.to_be_renamed
155+
156+
[DEPRECATED] Example event disabled by default.
157+
158+
The event will be renamed soon.
159+
160+
#### Attributes
161+
162+
| Name | Description | Values |
163+
| ---- | ----------- | ------ |
164+
| string_attr | Attribute with any string value. | Any Str |
165+
| boolean_attr | Attribute with a boolean value. | Any Bool |
166+
| boolean_attr2 | Another attribute with a boolean value. | Any Bool |
167+
144168
## Resource Attributes
145169
146170
| Name | Description | Values | Enabled |

cmd/mdatagen/internal/templates/documentation.md.tmpl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,29 @@ events:
174174
{{- end }}
175175
{{- end }}
176176

177+
{{- $optionalEventSeen := false }}
178+
{{- range $eventName, $event := .Events }}
179+
{{- if not $event.Enabled }}
180+
{{- if not $optionalEventSeen }}
181+
182+
## Optional Events
183+
184+
The following events are not emitted by default. Each of them can be enabled by applying the following configuration:
185+
186+
```yaml
187+
events:
188+
<event_name>:
189+
enabled: true
190+
```
191+
192+
{{- end }}
193+
{{- $optionalEventSeen = true }}
194+
195+
{{ template "event-documentation" $eventName }}
196+
197+
{{- end }}
198+
{{- end }}
199+
177200
{{- if .ResourceAttributes }}
178201

179202
## Resource Attributes

0 commit comments

Comments
 (0)