Conversation
mdisibio
left a comment
There was a problem hiding this comment.
Very nice improvements 👍 I think it would be worth running the benchmarks with TargetInfoEnabled, and fixing the buffer reuse in that mode. Left a few surface-level comments too.
| } | ||
|
|
||
| return keys, values | ||
| return keys[:count], values[:count] |
There was a problem hiding this comment.
Since the slices start with 0 length and are appended to, don't think the reslice or count tracking are needed.
| func SanitizeLabelNameWithCollisions(name string, dimensions []string) string { | ||
| sanitized := strutil.SanitizeLabelName(name) | ||
|
|
||
| if IsIntrinsicDimension(sanitized, dimensions) { |
There was a problem hiding this comment.
Can probably replace all of IsIntrinsicDimension with slices.Contains
| resourceValues = resourceValues[:0] | ||
| if p.Cfg.EnableTargetInfo { | ||
| resourceLabels, resourceValues = processor_util.GetTargetInfoAttributesValues(rs.Resource.Attributes, p.Cfg.TargetInfoExcludedDimensions) | ||
| resourceLabels, resourceValues = processor_util.GetTargetInfoAttributesValues(rs.Resource.Attributes, p.Cfg.TargetInfoExcludedDimensions, intrinsicLabels) |
There was a problem hiding this comment.
When TargetInfo is enabled, this will still realloc the labels and values on every loop iteration. It should be possible to pass them in to GetTargetInfoAttributesValues to reuse them, which would be a nice improvement in that mode.
|
latest benchmarks target info disabled target info enabled |
What this PR does: Generator improvements based on @mdisibio 's notes for things relating to target_info.
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]