diff --git a/pkg/ottl/context_inferrer.go b/pkg/ottl/context_inferrer.go index 0032d4c67a544..bbaa28e3c74b7 100644 --- a/pkg/ottl/context_inferrer.go +++ b/pkg/ottl/context_inferrer.go @@ -21,6 +21,7 @@ var defaultContextInferPriority = []string{ "metric", "spanevent", "span", + "profile", "scope", "instrumentation_scope", "resource", diff --git a/pkg/ottl/context_inferrer_test.go b/pkg/ottl/context_inferrer_test.go index ef9df4369ea48..2e3d488cc86d9 100644 --- a/pkg/ottl/context_inferrer_test.go +++ b/pkg/ottl/context_inferrer_test.go @@ -296,6 +296,7 @@ func Test_NewPriorityContextInferrer_DefaultPriorityList(t *testing.T) { "metric", "spanevent", "span", + "profile", "scope", "instrumentation_scope", "resource", @@ -316,6 +317,7 @@ func Test_NewPriorityContextInferrer_InferStatements_DefaultContextsOrder(t *tes "datapoint": newDummyPriorityContextInferrerCandidate(true, true, []string{"scope", "instrumentation_scope", "resource"}), "span": newDummyPriorityContextInferrerCandidate(true, true, []string{"spanevent", "scope", "instrumentation_scope", "resource"}), "spanevent": newDummyPriorityContextInferrerCandidate(true, true, []string{"scope", "instrumentation_scope", "resource"}), + "profile": newDummyPriorityContextInferrerCandidate(true, true, []string{"profile", "scope", "instrumentation_scope", "resource"}), "scope": newDummyPriorityContextInferrerCandidate(true, true, []string{"resource"}), "instrumentation_scope": newDummyPriorityContextInferrerCandidate(true, true, []string{"resource"}), "resource": newDummyPriorityContextInferrerCandidate(true, true, []string{}), @@ -386,6 +388,16 @@ func Test_NewPriorityContextInferrer_InferStatements_DefaultContextsOrder(t *tes statement: `set(span.name, "foo") where spanevent.name != nil and scope.name != nil and resource.attributes["foo"] != nil`, expected: "spanevent", }, + { + name: "profile,instrumentation_scope,resource", + statement: `set(profile.name, "foo") where profile.name != nil and instrumentation_scope.name != nil and resource.attributes["foo"] != nil`, + expected: "profile", + }, + { + name: "profile,scope,resource", + statement: `set(profile.name, "foo") where profile.name != nil and scope.name != nil and resource.attributes["foo"] != nil`, + expected: "profile", + }, { name: "resource", statement: `set(resource.attributes["bar"], "foo") where dummy.attributes["foo"] != nil`, @@ -409,6 +421,7 @@ func Test_NewPriorityContextInferrer_InferConditions_DefaultContextsOrder(t *tes "datapoint": newDummyPriorityContextInferrerCandidate(true, true, []string{"scope", "instrumentation_scope", "resource"}), "span": newDummyPriorityContextInferrerCandidate(true, true, []string{"spanevent", "scope", "instrumentation_scope", "resource"}), "spanevent": newDummyPriorityContextInferrerCandidate(true, true, []string{"scope", "instrumentation_scope", "resource"}), + "profile": newDummyPriorityContextInferrerCandidate(true, true, []string{"profile", "scope", "instrumentation_scope", "resource"}), "scope": newDummyPriorityContextInferrerCandidate(true, true, []string{"resource"}), "instrumentation_scope": newDummyPriorityContextInferrerCandidate(true, true, []string{"resource"}), "resource": newDummyPriorityContextInferrerCandidate(true, true, []string{}), @@ -479,6 +492,16 @@ func Test_NewPriorityContextInferrer_InferConditions_DefaultContextsOrder(t *tes condition: `span.name != nil and spanevent.name != nil and scope.name != nil and resource.attributes["foo"] != nil`, expected: "spanevent", }, + { + name: "profile,instrumentation_scope,resource", + condition: `profile.name != nil and profile.name != nil and instrumentation_scope.name != nil and resource.attributes["foo"] != nil`, + expected: "profile", + }, + { + name: "profile,scope,resource", + condition: `profile.name != nil and profile.name != nil and scope.name != nil and resource.attributes["foo"] != nil`, + expected: "profile", + }, { name: "resource", condition: `resource.attributes["bar"] != nil and dummy.attributes["foo"] != nil`,