From 66fdd04feb6b3ae4e29713e9b40ac102584af43d Mon Sep 17 00:00:00 2001 From: hamzamu Date: Mon, 15 Jan 2024 17:35:08 -0500 Subject: [PATCH 1/6] updated readme --- pkg/ottl/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ottl/README.md b/pkg/ottl/README.md index 2c25f746009a..287b595fb5de 100644 --- a/pkg/ottl/README.md +++ b/pkg/ottl/README.md @@ -9,7 +9,7 @@ [alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha -The OpenTelemetry Transformation Language is a language for transforming open telemetry data based on the [OpenTelemetry Collector Processing Exploration](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/processing.md). +(test)The OpenTelemetry Transformation Language is a language for transforming open telemetry data based on the [OpenTelemetry Collector Processing Exploration](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/processing.md). This package reads in OTTL statements and converts them to invokable functions/booleans based on the OTTL's grammar. From 3da12754e17a402e5ba52cca25950eaeb0c96b65 Mon Sep 17 00:00:00 2001 From: hamzamu Date: Mon, 15 Jan 2024 18:17:20 -0500 Subject: [PATCH 2/6] godoc comments to non-commented public interfaces in [pkg/ottl] packages --- pkg/ottl/expression.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/ottl/expression.go b/pkg/ottl/expression.go index f1adaa161e8d..b6b37700a531 100644 --- a/pkg/ottl/expression.go +++ b/pkg/ottl/expression.go @@ -27,14 +27,19 @@ func (e Expr[K]) Eval(ctx context.Context, tCtx K) (any, error) { return e.exprFunc(ctx, tCtx) } +// Getter is a interface that returns value of type any. type Getter[K any] interface { + // Get retrieves a value of type Any. Get(ctx context.Context, tCtx K) (any, error) } +// Setter is an interface that sets a value of type Any. type Setter[K any] interface { + // Set sets a value of type Any. Set(ctx context.Context, tCtx K, val any) error } +// GetSetter is a an interface that combines the Getter and Setter interfaces. type GetSetter[K any] interface { Getter[K] Setter[K] @@ -284,6 +289,7 @@ func (g StandardBoolGetter[K]) Get(ctx context.Context, tCtx K) (bool, error) { // FunctionGetter uses a function factory to return an instantiated function as an Expr. type FunctionGetter[K any] interface { + // Get retrieves Expr[K] from given Argument, args Get(args Arguments) (Expr[K], error) } From 7d4b127e3fdb61899d09b1d610d3a51eba6d52d7 Mon Sep 17 00:00:00 2001 From: hamzamu Date: Mon, 15 Jan 2024 18:22:02 -0500 Subject: [PATCH 3/6] godoc comments added to non-commented public interfaces in [pkg/ottl] packages --- pkg/ottl/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ottl/README.md b/pkg/ottl/README.md index 287b595fb5de..2c25f746009a 100644 --- a/pkg/ottl/README.md +++ b/pkg/ottl/README.md @@ -9,7 +9,7 @@ [alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha -(test)The OpenTelemetry Transformation Language is a language for transforming open telemetry data based on the [OpenTelemetry Collector Processing Exploration](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/processing.md). +The OpenTelemetry Transformation Language is a language for transforming open telemetry data based on the [OpenTelemetry Collector Processing Exploration](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/processing.md). This package reads in OTTL statements and converts them to invokable functions/booleans based on the OTTL's grammar. From 5001526186610d4db0f81910bb2983b8e621b626 Mon Sep 17 00:00:00 2001 From: hamza <75766435+hamzmu@users.noreply.github.com> Date: Tue, 16 Jan 2024 20:27:18 -0500 Subject: [PATCH 4/6] Apply suggestions from code review Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com> Co-authored-by: Curtis Robert Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> --- pkg/ottl/expression.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/ottl/expression.go b/pkg/ottl/expression.go index b6b37700a531..9b0871a82d60 100644 --- a/pkg/ottl/expression.go +++ b/pkg/ottl/expression.go @@ -27,19 +27,20 @@ func (e Expr[K]) Eval(ctx context.Context, tCtx K) (any, error) { return e.exprFunc(ctx, tCtx) } -// Getter is a interface that returns value of type any. +// Getter resolves a value at runtime without performing any type checking on the value that is returned. type Getter[K any] interface { // Get retrieves a value of type Any. Get(ctx context.Context, tCtx K) (any, error) } -// Setter is an interface that sets a value of type Any. +// Setter allows setting an untyped value on a predefined field within some data at runtime. type Setter[K any] interface { // Set sets a value of type Any. Set(ctx context.Context, tCtx K, val any) error } -// GetSetter is a an interface that combines the Getter and Setter interfaces. +// GetSetter is an interface that combines the Getter and Setter interfaces. +// It should be used to represent the ability to both get and set a value.``` type GetSetter[K any] interface { Getter[K] Setter[K] @@ -289,7 +290,7 @@ func (g StandardBoolGetter[K]) Get(ctx context.Context, tCtx K) (bool, error) { // FunctionGetter uses a function factory to return an instantiated function as an Expr. type FunctionGetter[K any] interface { - // Get retrieves Expr[K] from given Argument, args + // Get returns a function as an Expr[K] built with the provided Arguments Get(args Arguments) (Expr[K], error) } From 637c62b95b43efeb097387b9e8967726bde98731 Mon Sep 17 00:00:00 2001 From: hamzamu Date: Tue, 16 Jan 2024 20:36:03 -0500 Subject: [PATCH 5/6] updates based on code review --- pkg/ottl/expression.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/ottl/expression.go b/pkg/ottl/expression.go index 9b0871a82d60..098805da78a0 100644 --- a/pkg/ottl/expression.go +++ b/pkg/ottl/expression.go @@ -29,13 +29,13 @@ func (e Expr[K]) Eval(ctx context.Context, tCtx K) (any, error) { // Getter resolves a value at runtime without performing any type checking on the value that is returned. type Getter[K any] interface { - // Get retrieves a value of type Any. + // Get retrieves a value of type 'Any' and returns an error if there are any issues during retrieval. Get(ctx context.Context, tCtx K) (any, error) } // Setter allows setting an untyped value on a predefined field within some data at runtime. type Setter[K any] interface { - // Set sets a value of type Any. + // Set sets a value of type 'Any' and returns an error if there are any issues during the setting process. Set(ctx context.Context, tCtx K, val any) error } From f8315383df621c0d103cebb709397008990d39b1 Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Wed, 17 Jan 2024 14:34:29 -0700 Subject: [PATCH 6/6] Update pkg/ottl/expression.go Co-authored-by: Curtis Robert --- pkg/ottl/expression.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ottl/expression.go b/pkg/ottl/expression.go index 098805da78a0..6f6cc18b81c7 100644 --- a/pkg/ottl/expression.go +++ b/pkg/ottl/expression.go @@ -40,7 +40,7 @@ type Setter[K any] interface { } // GetSetter is an interface that combines the Getter and Setter interfaces. -// It should be used to represent the ability to both get and set a value.``` +// It should be used to represent the ability to both get and set a value. type GetSetter[K any] interface { Getter[K] Setter[K]