Skip to content

[pkg/ottl] ottlscope.TransformContext misuses scope schema as resource schema #47784

@axw

Description

@axw

Component(s)

pkg/ottl

What happened?

Description

Resource and scope each have their own schema URL, e.g. for logs see https://github.com/open-telemetry/opentelemetry-proto/blob/85e63b1ad6d0667e48707e8c0a88f366e79a68ce/opentelemetry/proto/logs/v1/logs.proto#L62-L64

ottlscope.NewTransformContextPtr takes a single ambiguous "schemaURLItem" without specifying if it's for the scope or resource. The same schema URL ends up being returned for both scope.schema_url and resource.schema_url paths:

// GetScopeSchemaURLItem returns the schema URL item for the scope from the TransformContext.
func (tCtx *TransformContext) GetScopeSchemaURLItem() ctxcommon.SchemaURLItem {
return tCtx.schemaURLItem
}
// GetResourceSchemaURLItem returns the schema URL item for the resource from the TransformContext.
func (tCtx *TransformContext) GetResourceSchemaURLItem() ctxcommon.SchemaURLItem {
return tCtx.schemaURLItem
}

Collector version

main

Environment information

Environment

N/A

OpenTelemetry Collector configuration

Log output

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpkg/ottl

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions