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

feat: Improved metrics setup #434

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

nhhagen
Copy link
Member

@nhhagen nhhagen commented Nov 29, 2024

Closes: #433

@nhhagen nhhagen force-pushed the metrics-2024-11-28-23-16-19 branch 2 times, most recently from c4422a8 to 3aa2723 Compare November 29, 2024 10:19
@nhhagen nhhagen force-pushed the metrics-2024-11-28-23-16-19 branch 2 times, most recently from 78ef6d5 to 5e97bf6 Compare November 29, 2024 10:36
@nhhagen nhhagen mentioned this pull request Nov 29, 2024
@nhhagen nhhagen force-pushed the new-bootstrap-2024-11-27-12-16-36 branch from d264342 to 79bfb06 Compare December 2, 2024 11:40
@nhhagen nhhagen force-pushed the metrics-2024-11-28-23-16-19 branch from 5e97bf6 to 7974730 Compare December 2, 2024 11:41
metrics/metrics.go Outdated Show resolved Hide resolved
metrics/options.go Outdated Show resolved Hide resolved
@nhhagen nhhagen force-pushed the metrics-2024-11-28-23-16-19 branch from 3504563 to 0c1cbe2 Compare December 3, 2024 11:13
metrics/metrics.go Outdated Show resolved Hide resolved
metrics/metrics.go Outdated Show resolved Hide resolved
@nhhagen nhhagen force-pushed the new-bootstrap-2024-11-27-12-16-36 branch 3 times, most recently from e0b7ea2 to 2baf280 Compare December 6, 2024 08:01
@nhhagen nhhagen force-pushed the new-bootstrap-2024-11-27-12-16-36 branch from 3a4e5b3 to 2b33af6 Compare December 16, 2024 06:43
@nhhagen nhhagen force-pushed the metrics-2024-11-28-23-16-19 branch 3 times, most recently from c113094 to db8bd4b Compare December 16, 2024 07:12
@nhhagen nhhagen force-pushed the new-bootstrap-2024-11-27-12-16-36 branch from 2b33af6 to dee8cd9 Compare December 16, 2024 07:13
@nhhagen nhhagen force-pushed the metrics-2024-11-28-23-16-19 branch from db8bd4b to a852e96 Compare December 16, 2024 07:14
@nhhagen nhhagen force-pushed the new-bootstrap-2024-11-27-12-16-36 branch 4 times, most recently from 1448895 to c8ea8db Compare December 16, 2024 12:43
@nhhagen nhhagen force-pushed the metrics-2024-11-28-23-16-19 branch from a852e96 to 45c1c89 Compare December 16, 2024 14:05
Base automatically changed from new-bootstrap-2024-11-27-12-16-36 to main December 16, 2024 14:18
@nhhagen nhhagen force-pushed the metrics-2024-11-28-23-16-19 branch 2 times, most recently from 2af0abf to ef50ba6 Compare December 16, 2024 14:22
@nhhagen nhhagen force-pushed the metrics-2024-11-28-23-16-19 branch from ef50ba6 to aced0c0 Compare December 16, 2024 14:23
@nhhagen nhhagen force-pushed the metrics-2024-11-28-23-16-19 branch from 49055cc to 711da4f Compare December 16, 2024 14:34
@nhhagen nhhagen changed the title Improved metrics setup feat: Improved metrics setup Dec 16, 2024
@nhhagen nhhagen marked this pull request as ready for review December 16, 2024 14:34

// WithTags sets the tags that are sent with every metric, shorthand for
// statsd.WithTags()
func WithTags(tags ...string) Option {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't allow clients of this lib to remove the default tags (environment:*, service:* and version:*), especially since the lib cannot be initiailized if env vars for those tags are missing. Maybe change the func name to WithExtraTags() and append passed tags to options.tags instead of replacing them?

func WithExtraTags(tags ...string) Option {
	return func(options *options) error {
		options.tags = append(options.tags, tags...)
		return nil
	}
}

Copy link
Member Author

@nhhagen nhhagen Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree the default ones should not be removed. I prefer the name WithTags. I'll ensure the default ones are not removed when setting tags. I want having to support repetitive calls to the function as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improved metrics API
3 participants