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
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,31 @@ 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
+
-`docker_stats` (not `dockerstats`)
21
+
-`k8s_cluster` (not `k8scluster`)
22
+
-`otlp_http` (not `otlphttp`)
23
+
24
+
For example, a component with identifier `memory_limiter` would typically have a Go package name like `memorylimiterprocessor`.
25
+
26
+
#### Migration for existing components
27
+
28
+
Components that currently use a different naming convention:
29
+
- SHOULD add the `lower_snake_case` name as the primary identifier
30
+
- MAY support the old name as a deprecated alias for backwards compatibility
31
+
- MUST document the migration path in their README
32
+
33
+
Only components following the `lower_snake_case` naming convention should be marked as stable.
34
+
35
+
### Go API naming conventions
36
+
12
37
To keep naming patterns consistent across the project, naming patterns are enforced to make intent clear by:
13
38
14
39
- 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 +63,7 @@ To keep naming patterns consistent across the project, naming patterns are enfor
38
63
-`func CreateTracesExport(...) {...}`
39
64
-`func CreateTracesToTracesFunc(...) {...}`
40
65
41
-
### Configuration structs
66
+
####Configuration structs
42
67
43
68
When naming configuration structs, use the following guidelines:
0 commit comments