You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document the new `lower_snake_case` naming convention for OpenTelemetry
Collector components in the coding guidelines as result of discussion in
#14208.
Copy file name to clipboardExpand all lines: docs/coding-guidelines.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,29 @@ interaction with a human (such as this Collector).
9
9
10
10
## Naming convention
11
11
12
+
### Component naming
13
+
14
+
Components (receivers, processors, exporters, extensions, and connectors) MUST use `lower_snake_case` naming convention. This ensures consistency and enhances readability for end users.
15
+
16
+
This naming convention applies to the component identifier used in configuration files and component registration, not to Go package names which follow standard Go naming conventions (lowercase, no underscores).
17
+
18
+
Examples of correct component names:
19
+
-`memory_limiter` (not `memorylimiter`)
20
+
-`otlp_http` (not `otlphttp`)
21
+
22
+
For example, a component with identifier `memory_limiter` would typically have a Go package name like `memorylimiterprocessor`.
23
+
24
+
#### Migration for existing components
25
+
26
+
Components that currently use a different naming convention:
27
+
- SHOULD add the `lower_snake_case` name as the primary identifier
28
+
- MAY support the old name as a deprecated alias for backwards compatibility
29
+
- MUST document the migration path in their README
30
+
31
+
Only components following the `lower_snake_case` naming convention should be marked as stable.
32
+
33
+
### Go API naming conventions
34
+
12
35
To keep naming patterns consistent across the project, naming patterns are enforced to make intent clear by:
13
36
14
37
- Methods that return a variable that uses the zero value or values provided via the method MUST have the prefix `New`. For example:
@@ -38,7 +61,7 @@ To keep naming patterns consistent across the project, naming patterns are enfor
38
61
-`func CreateTracesExport(...) {...}`
39
62
-`func CreateTracesToTracesFunc(...) {...}`
40
63
41
-
### Configuration structs
64
+
####Configuration structs
42
65
43
66
When naming configuration structs, use the following guidelines:
0 commit comments