census-instrumentation/opencensus-go

Add tag.MustNewKey

Opened this issue · 1 comments

fabxc commented

Currently one needs to declare tag keys in a var block and then initialize them in an init function. This adds a fair amount of boilerplate just for instrumentation.

Adding a tag.MustNewKey function that panics on invalid keys would allow to define new keys in a single line. The only sane option if tag.NewKey returns an error is exiting the program immediately anyway it seems. So effective program behavior wouldn't be altered.

Addressed by #1141