From 209e3e880e7038de08f333bb1bff97b6ea41a7d8 Mon Sep 17 00:00:00 2001 From: odubajDT <93584209+odubajDT@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:20:41 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Edmo Vamerlatti Costa <11836452+edmocosta@users.noreply.github.com> --- .chloggen/ottl-timestamp.yaml | 4 ++-- pkg/ottl/ottlfuncs/README.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.chloggen/ottl-timestamp.yaml b/.chloggen/ottl-timestamp.yaml index 0586c1589142..d7c0bf0fdfa2 100644 --- a/.chloggen/ottl-timestamp.yaml +++ b/.chloggen/ottl-timestamp.yaml @@ -7,7 +7,7 @@ change_type: enhancement component: pkg/ottl # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Introduce new FormatTime() converter function." +note: "Add the `FormatTime` function to convert `time.Time` values to human-readable strings" # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. issues: [36870] @@ -24,4 +24,4 @@ subtext: # Include 'user' if the change is relevant to end users. # Include 'api' if there is a change to a library API. # Default: '[user]' -change_logs: [] +change_logs: [user] diff --git a/pkg/ottl/ottlfuncs/README.md b/pkg/ottl/ottlfuncs/README.md index 04b9d2b3abce..59795f56d4f1 100644 --- a/pkg/ottl/ottlfuncs/README.md +++ b/pkg/ottl/ottlfuncs/README.md @@ -1966,13 +1966,13 @@ Examples: `FormatTime(time, format)` -The `FormatTime` Converter takes a `time.Time` and converts it to a human readable string representations of the time according to the specidied format. +The `FormatTime` Converter takes a `time.Time` and converts it to a human-readable string representation of the time according to the specified format. `time` is `time.Time`. If `time` is another type an error is returned. `format` is a string. -If `format` is nil, an error is returned. The parser used is the parser at [internal/coreinternal/parser](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/internal/coreinternal/timeutils). If `format` does not follow the parsing rules used by this parser, an error is returned. +If either `time` or `format` are nil, an error is returned. The parser used is the parser at [internal/coreinternal/parser](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/internal/coreinternal/timeutils). If `format` does not follow the parsing rules used by this parser, an error is returned. -`format` denotes a textual and human readable representation of the resulting time value formatted according to ctime-like format string. It follows [standard Go Layout formatting](https://pkg.go.dev/time#pkg-constants) with few additional substitutes: +`format` denotes a human-readable textual representation of the resulting time value formatted according to ctime-like format string. It follows [standard Go Layout formatting](https://pkg.go.dev/time#pkg-constants) with few additional substitutes: | substitution | description | examples | |-----|-----|-----| |`%Y` | Year as a zero-padded number | 0001, 0002, ..., 2019, 2020, ..., 9999 |