-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide access to the SchemaURL fields from the OTTL contexts #30229
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Hi @TylerHelmuth! Can I take this up ? |
All yours! |
@TylerHelmuth I am lacking a bit of clarity, on what needs to be done for this issue ? Could you point me to the exact piece of code i should be looking at. |
Take a look at pkg/ottl/contexts/internal/scope.go. You'll want to add a new case to the switch statement. |
@TylerHelmuth Sorry for my delayed response. Here is my understanding till now.
I will have to add a field specifically for the "schemaURL" context for the as part of ScopePathGetSetter function.
Sorry for my silly questions, I couldn't get my head around the documentation till now 😅 |
Oh I see the problem now, This makes it a lot harder to add :/ We'd need to update the TransformContext of each Context to have access to the value, which will be a lot of breaking changes. I don't want to expose all the entire This problem is no longer easy (you're welcome to continue working on it anyways). @evan-bradley how do you think we should expose these 2 fields from the proto? OTTL has always followed the proto to the letter, and |
I'll like to continue working on this issue. @evan-bradley any suggestions on how we should expose the schema_url from the proto. |
I'm not sure the last statement will always hold true (each resource and scope can have it's own value for the field), but I would say we can just take the approach you're suggesting and expose the Schema URL like other fields. If enough users want to modify scopes (as opposed to just reading from them in a lower-level contexts) then we should add a context to make that more efficient. |
Lets start with that approach and see what happens. @kernelpanic77 let's start small by modifying only the |
@kernelpanic77 the name of the structs that contain You're going to run into a challenge with the generic @evan-bradley this situation has highlighted that |
Could we solve the fact that they're different concrete types with an interface like this? type SchemaURLItem interface {
SchemaUrl() string
SetSchemaUrl(v string)
} I think all of those types would conform to this interface. |
Ya something like that would work. |
From my understanding till now, the following changes can be added to type TransformContext struct {
resource pcommon.Resource
cache pcommon.Map
schemaURL string
} func NewTransformContext(resource pcommon.Resource, schemaURL string) TransformContext {
return TransformContext{
resource: resource,
cache: pcommon.NewMap(),
schemaURL: schemaURL,
}
} Here I am adding the schemaURL to the NewTransformContext method, along with that the corresponding getters and setters have to be added in the accessSchemaURL function. I will also fix the breaking references of NewTransformContext inside the |
@kernelpanic77 passing only the string isn't enough. The TransformContext will need access to the Dont start with Resource or Scope, those will be hard. Try implementing for |
@TylerHelmuth This is my attempt to implement for ottllog, have a look. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This PR attempts to make schemaURL for TransformContexts. **Description:** <Describe what has changed.> Added a breaking change to creation of TransformContext function for logs. Also made changes to all references of the function. **Link to tracking Issue:** <Issue number if applicable> #30229 --------- Co-authored-by: Evan Bradley <[email protected]> Co-authored-by: Tyler Helmuth <[email protected]>
This PR attempts to make schemaURL for TransformContexts. **Description:** <Describe what has changed.> Added a breaking change to creation of TransformContext function for logs. Also made changes to all references of the function. **Link to tracking Issue:** <Issue number if applicable> open-telemetry#30229 --------- Co-authored-by: Evan Bradley <[email protected]> Co-authored-by: Tyler Helmuth <[email protected]>
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
Currently, there is no way to access the SchemaURL fields from the OTTL contexts. Having access to the SchemaURL within the OTTL contexts would enhance the functionality and flexibility of using OTTL.
Describe the solution you'd like
Add the SchemaURL fields to the list of available fields that can be accessed within the OTTL contexts.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: