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

Use WithFoo() arguments to autometrics.Init instead of long function signature #83

Merged

Conversation

gagbo
Copy link
Member

@gagbo gagbo commented Nov 27, 2023

Description

Instead of having a long function signature with various custom types for Init, we
use the With... option pattern to make the API easier to remember and use.

On top of that , as long as we provide default values, we can add extra initialization
arguments without making breaking changes.

Still todo (on top of the checklist below):

  • Update the README with the new signature
  • Update the examples so that they compile...
  • ...and the main.go.orig too
  • Remove the extra container structs that aren't used anymore (like PushConfiguration)

Fixes AM-141

Checklist

  • The CHANGELOG is updated.
  • The open-telemetry example in repository works fine:
    • the docker compose file is valid
    • the application compiles and run
    • alerts are getting triggered in Prometheus
  • The prometheus example in repository works fine:
    • the docker compose file is valid
    • the application compiles and run
    • alerts are getting triggered in Prometheus
    • exemplars are accessible on the graph

@gagbo gagbo marked this pull request as ready for review November 27, 2023 19:39
@gagbo gagbo merged commit ebefae1 into main Dec 1, 2023
7 checks passed
@gagbo gagbo deleted the am-141-change-the-init-signature-to-have-withfoo-style-option branch December 1, 2023 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants