forked from open-telemetry/weaver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide max line-length in comment filter. (open-telemetry#454)
* Merge with main. * Fix clippy issues. * Update go template to more accurrately match go style. Update expected output to use go fmt. * Add markdown link parser to word split algorithm * Fix accidental split of words by hyphens * Add dynamic line-length argument and test. * Update docs for line_length config. * Update HTML rendering to do word-wrapping on its own. * Fix tests. * Abstract out word-wrapping features of HTML renderer. * Add word wrapping to markdown renderer. * Get all unit tests passing. * Fix up markdown word wrap to pass more tests. * Fix issue with word-wrap tracking. Two remaining go rendering issues. * Clean up architecture of word wrapping. * Add go list-style rendering for markdown format. * Fix clippy. * update go example to deal with newline hell in jinja. * Fix spelling issue. * Fix spelling. * Update crates/weaver_forge/src/formats/markdown.rs Co-authored-by: Laurent Quérel <[email protected]> * Fixes from code review. --------- Co-authored-by: Laurent Quérel <[email protected]> Co-authored-by: Laurent Quérel <[email protected]>
- Loading branch information
1 parent
1529f30
commit aeae196
Showing
13 changed files
with
1,873 additions
and
529 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
233 changes: 126 additions & 107 deletions
233
crates/weaver_forge/expected_output/comment_format/example.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,122 +1,141 @@ | ||
// Examples of comments for group device | ||
package test | ||
|
||
// DEVICE_ID | ||
// A unique identifier representing the device | ||
// | ||
// The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier]. On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here] on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence | ||
// | ||
// [vendor identifier]: https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor | ||
// [here]: https://developer.android.com/training/articles/user-data-ids | ||
const DEVICE_ID = "" | ||
// Examples of comments for group device | ||
|
||
// DEVICE_MANUFACTURER | ||
// The name of the device manufacturer | ||
// | ||
// The Android OS provides this field via [Build]. iOS apps SHOULD hardcode the value `Apple` | ||
// | ||
// [Build]: https://developer.android.com/reference/android/os/Build#MANUFACTURER | ||
const DEVICE_MANUFACTURER = "" | ||
// DEVICE_ID | ||
// A unique identifier representing the device | ||
// | ||
// The device identifier MUST only be defined using the values outlined below. | ||
// This value is not an advertising identifier and MUST NOT be used as such. On | ||
// iOS (Swift or Objective-C), this value MUST be equal to the | ||
// [vendor identifier]. On Android (Java or Kotlin), this value MUST be equal to | ||
// the Firebase Installation ID or a globally unique UUID which is persisted | ||
// across sessions in your application. More information can be found [here] on | ||
// best practices and exact implementation details. Caution should be taken when | ||
// storing personal data or anything which can identify a user. GDPR and data | ||
// protection laws may apply, ensure you do your own due diligence | ||
// | ||
// [vendor identifier]: https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor | ||
// [here]: https://developer.android.com/training/articles/user-data-ids | ||
const DEVICE_ID = "" | ||
|
||
// DEVICE_MODEL_IDENTIFIER | ||
// The model identifier for the device | ||
// | ||
// It's recommended this value represents a machine-readable version of the model identifier rather than the market or consumer-friendly name of the device | ||
const DEVICE_MODEL_IDENTIFIER = "" | ||
// DEVICE_MANUFACTURER | ||
// The name of the device manufacturer | ||
// | ||
// The Android OS provides this field via [Build]. iOS apps SHOULD hardcode the | ||
// value `Apple` | ||
// | ||
// [Build]: https://developer.android.com/reference/android/os/Build#MANUFACTURER | ||
const DEVICE_MANUFACTURER = "" | ||
|
||
// DEVICE_MODEL_NAME | ||
// The marketing name for the device model | ||
// | ||
// It's recommended this value represents a human-readable version of the device model rather than a machine-readable alternative | ||
const DEVICE_MODEL_NAME = "" | ||
// DEVICE_MODEL_IDENTIFIER | ||
// The model identifier for the device | ||
// | ||
// It's recommended this value represents a machine-readable version of the model | ||
// identifier rather than the market or consumer-friendly name of the device | ||
const DEVICE_MODEL_IDENTIFIER = "" | ||
|
||
// DEVICE_MODEL_NAME | ||
// The marketing name for the device model | ||
// | ||
// It's recommended this value represents a human-readable version of the device | ||
// model rather than a machine-readable alternative | ||
const DEVICE_MODEL_NAME = "" | ||
|
||
// Examples of comments for group dns | ||
|
||
// DNS_QUESTION_NAME | ||
// The name being queried. | ||
// | ||
// If the name field contains non-printable characters (below 32 or above 126), those characters should be represented as escaped base 10 integers (\DDD). Back slashes and quotes should be escaped. Tabs, carriage returns, and line feeds should be converted to \t, \r, and \n respectively | ||
const DNS_QUESTION_NAME = "" | ||
|
||
// DNS_QUESTION_NAME | ||
// The name being queried. | ||
// | ||
// If the name field contains non-printable characters (below 32 or above 126), | ||
// those characters should be represented as escaped base 10 integers (\DDD). | ||
// Back slashes and quotes should be escaped. Tabs, carriage returns, and line | ||
// feeds should be converted to \t, \r, and \n respectively | ||
const DNS_QUESTION_NAME = "" | ||
|
||
// Examples of comments for group error | ||
|
||
// ERROR_TYPE | ||
// Describes a class of error the operation ended with. | ||
// | ||
// The `error.type` SHOULD be predictable, and SHOULD have low cardinality. | ||
// | ||
// When `error.type` is set to a type (e.g., an exception type), its | ||
// canonical class name identifying the type within the artifact SHOULD be used. | ||
// | ||
// Instrumentations SHOULD document the list of errors they report. | ||
// | ||
// The cardinality of `error.type` within one instrumentation library SHOULD be low. | ||
// Telemetry consumers that aggregate data from multiple instrumentation libraries and applications | ||
// should be prepared for `error.type` to have high cardinality at query time when no | ||
// additional filters are applied. | ||
// | ||
// If the operation has completed successfully, instrumentations SHOULD NOT set `error.type`. | ||
// | ||
// If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes), | ||
// it's RECOMMENDED to: | ||
// | ||
// - Use a domain-specific attribute | ||
// - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not | ||
const ERROR_TYPE = "" | ||
|
||
// ERROR_TYPE | ||
// Describes a class of error the operation ended with. | ||
// | ||
// The `error.type` SHOULD be predictable, and SHOULD have low cardinality. | ||
// | ||
// When `error.type` is set to a type (e.g., an exception type), its | ||
// canonical class name identifying the type within the artifact SHOULD be used. | ||
// | ||
// Instrumentations SHOULD document the list of errors they report. | ||
// | ||
// The cardinality of `error.type` within one instrumentation library SHOULD be | ||
// low. | ||
// Telemetry consumers that aggregate data from multiple instrumentation | ||
// libraries and applications | ||
// should be prepared for `error.type` to have high cardinality at query time | ||
// when no | ||
// additional filters are applied. | ||
// | ||
// If the operation has completed successfully, instrumentations SHOULD NOT set | ||
// `error.type`. | ||
// | ||
// If a specific domain defines its own set of error identifiers (such as HTTP or | ||
// gRPC status codes), | ||
// it's RECOMMENDED to: | ||
// | ||
// - Use a domain-specific attribute | ||
// - Set `error.type` to capture all errors, regardless of whether they are | ||
// defined within the domain-specific set or not | ||
const ERROR_TYPE = "" | ||
|
||
// Examples of comments for group other | ||
|
||
// ATTR | ||
// This is a brief description of the attribute + a short link [OTEL]. | ||
// | ||
// This is a note about the attribute `attr`. It can be multiline. | ||
// | ||
// It can contain a list: | ||
// | ||
// - item **1**, | ||
// - lorem ipsum dolor sit amet, consectetur | ||
// adipiscing elit sed do eiusmod tempor | ||
// [incididunt] ut labore et dolore magna aliqua. | ||
// - item 2 | ||
// - lorem ipsum dolor sit amet, consectetur | ||
// adipiscing elit sed do eiusmod tempor | ||
// incididunt ut labore et dolore magna aliqua. | ||
// | ||
// And an **inline code snippet**: `Attr.attr`. | ||
// | ||
// # Summary | ||
// | ||
// ## Examples | ||
// | ||
// 1. Example 1 | ||
// 2. [Example] with lorem ipsum dolor sit amet, consectetur adipiscing elit | ||
// [sed] do eiusmod tempor incididunt ut | ||
// [labore] et dolore magna aliqua. | ||
// 3. Example 3 | ||
// | ||
// ## Appendix | ||
// | ||
// - [Link 1] | ||
// - [Link 2] | ||
// - A very long item in the list with lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod | ||
// tempor incididunt ut labore et dolore magna aliqua. | ||
// | ||
// > This is a blockquote. | ||
// > It can contain multiple lines. | ||
// > Lorem ipsum dolor sit amet, consectetur adipiscing | ||
// > elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. | ||
// | ||
// > [!NOTE] Something very important here | ||
// | ||
// [OTEL]: https://www.opentelemetry.com | ||
// [incididunt]: https://www.loremipsum.com | ||
// [Example]: https://loremipsum.com | ||
// [sed]: https://loremipsum.com | ||
// [labore]: https://loremipsum.com | ||
// [Link 1]: https://www.link1.com | ||
// [Link 2]: https://www.link2.com | ||
const ATTR = "" | ||
|
||
// ATTR | ||
// This is a brief description of the attribute + a short link [OTEL]. | ||
// | ||
// This is a note about the attribute `attr`. It can be multiline. | ||
// | ||
// It can contain a list: | ||
// | ||
// - item **1**, | ||
// - lorem ipsum dolor sit amet, consectetur | ||
// adipiscing elit sed do eiusmod tempor | ||
// [incididunt] ut labore et dolore magna aliqua. | ||
// - item 2 | ||
// - lorem ipsum dolor sit amet, consectetur | ||
// adipiscing elit sed do eiusmod tempor | ||
// incididunt ut labore et dolore magna aliqua. | ||
// | ||
// And an **inline code snippet**: `Attr.attr`. | ||
// | ||
// # Summary | ||
// | ||
// ## Examples | ||
// | ||
// 1. Example 1 | ||
// 2. [Example] with lorem ipsum dolor sit amet, consectetur adipiscing elit | ||
// [sed] do eiusmod tempor incididunt ut | ||
// [labore] et dolore magna aliqua. | ||
// 3. Example 3 | ||
// | ||
// ## Appendix | ||
// | ||
// - [Link 1] | ||
// - [Link 2] | ||
// - A very long item in the list with lorem ipsum dolor sit amet, consectetur | ||
// adipiscing elit sed do eiusmod | ||
// tempor incididunt ut labore et dolore magna aliqua. | ||
// | ||
// > This is a blockquote. | ||
// > It can contain multiple lines. | ||
// > Lorem ipsum dolor sit amet, consectetur adipiscing | ||
// > elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. | ||
// | ||
// > [!NOTE] Something very important here | ||
// | ||
// [OTEL]: https://www.opentelemetry.com | ||
// [incididunt]: https://www.loremipsum.com | ||
// [Example]: https://loremipsum.com | ||
// [sed]: https://loremipsum.com | ||
// [labore]: https://loremipsum.com | ||
// [Link 1]: https://www.link1.com | ||
// [Link 2]: https://www.link2.com | ||
const ATTR = "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.