metrics: deduplicate tags on insertion into registry
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 71
- Forks
- 33
- Avg merge
- 6h 53m
- Merged PRs (30d)
- 6
Description
This library currently uses a slice to store tags [0]. However, Witchcraft converts the tags to a map when emitting them [1]. Even though the lossy behavior of converting the tag slice to a map is well-documented [2], it makes it difficult to debug issues involving multiple instances of the same tag key getting added to the metrics registry since the internal state diverges from what is logged. Since the Witchcraft spec defines a tag as a map<string, string> [3], let's move the deduplication of tags earlier in the pipeline such that it happens on insertion into the registry.
[0] https://github.com/palantir/pkg/blob/master/metrics/tag.go#L36
[1] https://github.com/palantir/witchcraft-go-server/blob/develop/witchcraft/server_metrics.go#L42
[2] https://github.com/palantir/pkg/blob/master/metrics/tag.go#L46-L49
[3] https://github.com/palantir/witchcraft-api/blob/master/witchcraft-logging-api/src/main/conjure/witchcraft-logging-api.yml#L369-L370
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in metrics/tag.go, especially the tag storage and conversion lines linked in the issue, then review the Witchcraft metrics references to understand the expected map behavior. Done means duplicate tag keys are removed when tags enter the registry, so internal registry state matches the emitted representation; add or update focused metrics tests if the repository provides them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100