Skip to content
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

View with rename function #3365

Open
rytsh opened this issue Oct 19, 2022 · 1 comment
Open

View with rename function #3365

rytsh opened this issue Oct 19, 2022 · 1 comment
Labels
area:metrics Part of OpenTelemetry Metrics blocked:specification Waiting on clarification of the OpenTelemetry specification before progress can be made enhancement New feature or request pkg:SDK Related to an SDK package

Comments

@rytsh
Copy link

rytsh commented Oct 19, 2022

Problem Statement

When creating a new view, I really like to add prefix string to all my instruments or regex to change it. I am thinking to add my service name as prefix.

Now I can just rename directly but if something like give a function to rename, I can write my new names based on instrument name.

This can also break the safety check of the rename but it would be good this kind of wildcard rename.

Proposed Solution

This is just an example code of how to implement:

func WithRenameFunc(fn func(string) string) Option {
	return optionFunc(func(v View) View {
                v.renameFunc = fn
		return v
	})
}

// In TransformInstrument after the v.name check
if v.renameFunc != nil {
    inst.Name = v.renameFunc(inst.Name)
}
@rytsh rytsh added the enhancement New feature or request label Oct 19, 2022
@Aneurysm9 Aneurysm9 added pkg:SDK Related to an SDK package area:metrics Part of OpenTelemetry Metrics blocked:specification Waiting on clarification of the OpenTelemetry specification before progress can be made labels Oct 19, 2022
@Aneurysm9
Copy link
Member

Thank you for your interest and suggestion. I believe that functionality like this would need to be vetted and defined in the OpenTelemetry specification before we could implement it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metrics Part of OpenTelemetry Metrics blocked:specification Waiting on clarification of the OpenTelemetry specification before progress can be made enhancement New feature or request pkg:SDK Related to an SDK package
Projects
None yet
Development

No branches or pull requests

2 participants