prom_ex icon indicating copy to clipboard operation
prom_ex copied to clipboard

feat: allow to pass mfa for git sha, git author and app version to lifecycle annotator

Open yordis opened this issue 1 year ago • 2 comments

Change description

What problem does this solve?

PromEx.LifecycleAnnotator forces us to use GIT_SHA, GIT_AUTHOR and vsn application spec to configure the annotation.

We would like to have the ability, as we do with PromEx.Plugins.Application, to pass an MFA configuration for all those values so we can customize it to our needs.

Issue number: (if applicable)

Example usage

Additional details and screenshots

Checklist

  • [ ] I have added unit tests to cover my changes.
  • [ ] I have added documentation to cover my changes.
  • [ ] My changes have passed unit tests and tested E2E in an example project.

yordis avatar Aug 25 '22 11:08 yordis

@akoutmos do you mind giving me your perspective here?

I am trying to allow to pass some MFA config because we do not use the current env variable names for the git author or git sha, and we would like to use an environment name for the app release version.

I am not sure what the configuration should look like.

For example:

config :app_name, MyApp.PromEx,
  lifecycle_annotator: []

Or

config :app_name, MyApp.PromEx.LifecycleAnnotator,
  [
    # ...
  ]

I am liking the latter since it is easier to implement and maintain.

yordis avatar Aug 25 '22 11:08 yordis

I would actually prefer the first version over the second as the second one leaks the internal implementation of the library to the user. What GenServers are started under the PromEx supervision tree is an implementation detail and could change in the future.

Let's move forward with the first version, and soft deprecate the :annotate_app_lifecycle config in favor of :lifecycle_annotator (https://github.com/akoutmos/prom_ex/blob/master/lib/prom_ex/config.ex#L121) with the functionality you propose for having MFAs as opposed to env vars.

akoutmos avatar Aug 27 '22 05:08 akoutmos