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
Copy file name to clipboardExpand all lines: pkg/ottl/CONTRIBUTING.md
+40-8Lines changed: 40 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -6,20 +6,52 @@ This guide is specific to the OpenTelemetry Transformation Language. All guidel
6
6
7
7
- Changes to the OpenTelemetry Transformation Language should be made independent of any component that depend on the package. Whenever possible, try not to submit PRs that change both the OTTL and a dependent component. Instead, submit a PR that updates the OTTL and then, once merged, update the component as needed.
8
8
9
-
## New Values
9
+
## Adding New Editors/Converters
10
10
11
-
When adding new values to the grammar you must:
11
+
Before raising a PR with a new Editor or Converter, raise an issue to verify its acceptance. While acceptance is strongly specific to a specific use case, consider these guidelines for early assessment.
12
12
13
-
1. Update the `Value` struct with the new value. This may also mean adding new token(s) to the lexer.
14
-
2. Update `NewFunctionCall` to be able to handle calling functions with this new value.
15
-
3. Update `NewGetter` to be able to handle the new value.
16
-
4. Add new unit tests.
13
+
Your proposal likely will be accepted if:
14
+
15
+
- The proposed functionality is missing,
16
+
- The proposed solution significantly improves user experience and readability for very common use cases,
17
+
- The proposed solution is more performant in cases where it is possible to achieve the same result with existing options.
18
+
19
+
It will be up for discussion if your proposal solves an issue that can be achieved in another way but does not improve user experience or performance.
20
+
21
+
Your proposal likely won't be accepted if:
22
+
23
+
- User experience is worse and assumes a highly technical user,
24
+
- The performance of your proposal very negatively affects the processing pipeline.
25
+
26
+
As with code, OTTL aims for readability first. This means:
17
27
18
-
## New Functions
28
+
- Using short, meaningful, and descriptive names,
29
+
- Ensuring naming consistency across Editors and Converters,
30
+
- Avoiding deep nesting to achieve desired transformations,
31
+
- Ensuring Editors and Converters have a single responsibility.
32
+
33
+
### Implementation guidelines
19
34
20
35
All new functions must be added via a new file. Function files must start with `func_`. Functions must be placed in `ottlfuncs`.
21
36
22
37
Unit tests must be added for all new functions. Unit test files must start with `func_` and end in `_test`. Unit tests must be placed in the same directory as the function. Functions that are not specific to a pipeline should be tested independently of any specific pipeline. Functions that are specific to a pipeline should be tests against that pipeline. End-to-end tests must be added in the `e2e` directory.
23
38
24
-
Function names should follow the [Function Syntax Guidelines](ottlfuncs/README.md#function-syntax)
39
+
#### Naming and Parameter Guidelines
40
+
41
+
Functions should be named and formatted according to the following standards.
42
+
43
+
- Function names MUST start with a verb unless it is a Factory that creates a new type.
44
+
- Converters MUST be UpperCamelCase.
45
+
- Function names that contain multiple words MUST separate those words with `_`.
46
+
- Functions that interact with multiple items MUST have plurality in the name. Ex: `truncate_all`, `keep_keys`, `replace_all_matches`.
47
+
- Functions that interact with a single item MUST NOT have plurality in the name. If a function would interact with multiple items due to a condition, like `where`, it is still considered singular. Ex: `set`, `delete`, `replace_match`.
48
+
- Functions that change a specific target MUST set the target as the first parameter.
25
49
50
+
## New Values
51
+
52
+
When adding new values to the grammar you must:
53
+
54
+
1. Update the `Value` struct with the new value. This may also mean adding new token(s) to the lexer.
55
+
2. Update `NewFunctionCall` to be able to handle calling functions with this new value.
56
+
3. Update `NewGetter` to be able to handle the new value.
Copy file name to clipboardExpand all lines: pkg/ottl/ottlfuncs/README.md
-32Lines changed: 0 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -2127,35 +2127,3 @@ The returned type is `int64`.
2127
2127
Examples:
2128
2128
2129
2129
- `Year(Now())`
2130
-
2131
-
## Function syntax
2132
-
2133
-
Functions should be named and formatted according to the following standards.
2134
-
2135
-
- Function names MUST start with a verb unless it is a Factory that creates a new type.
2136
-
- Converters MUST be UpperCamelCase.
2137
-
- Function names that contain multiple words MUST separate those words with `_`.
2138
-
- Functions that interact with multiple items MUST have plurality in the name. Ex: `truncate_all`, `keep_keys`, `replace_all_matches`.
2139
-
- Functions that interact with a single item MUST NOT have plurality in the name. If a function would interact with multiple items due to a condition, like `where`, it is still considered singular. Ex: `set`, `delete`, `replace_match`.
2140
-
- Functions that change a specific target MUST set the target as the first parameter.
2141
-
2142
-
## Adding New Editors/Converters
2143
-
2144
-
Before raising a PR with a new Editor or Converter, raise an issue to verify its acceptance. While acceptance is strongly specific to a specific use case, consider these guidelines for early assessment.
2145
-
2146
-
Your proposal likely will be accepted if:
2147
-
- The proposed functionality is missing,
2148
-
- The proposed solution significantly improves user experience and readability for very common use cases,
2149
-
- The proposed solution is more performant in cases where it is possible to achieve the same result with existing options.
2150
-
2151
-
It will be up for discussion if your proposal solves an issue that can be achieved in another way but does not improve user experience or performance.
2152
-
2153
-
Your proposal likely won't be accepted if:
2154
-
- User experience is worse and assumes a highly technical user,
2155
-
- The performance of your proposal very negatively affects the processing pipeline.
2156
-
2157
-
As with code, OTTL aims for readability first. This means:
2158
-
- Using short, meaningful, and descriptive names,
2159
-
- Ensuring naming consistency across Editors and Converters,
2160
-
- Avoiding deep nesting to achieve desired transformations,
2161
-
- Ensuring Editors and Converters have a single responsibility.
0 commit comments