newrelic-experimental / gitlab

Gitlab exporters to send metrics,logs,traces to New Relic
9 stars 6 forks source link

FR - GLAB_TAKE_NAMESPACE_SLUG #22

Open magicofit opened 1 year ago

magicofit commented 1 year ago

Hi,

i have a new issue with subgroups.

If a group in gitlab contains another group that contains the repository, then the repository is not found.

Example: MainGroup/SubGroup/MyRepository And if GLAB_EXPORT_PATHS is only "MainGroup", then "MyRepository" is not found.

(And i am not sure, if GLAB_SERVICE_NAME will be correct=MainGroup/SubGroup/MyRepository).

Additionally a GLAB_TAKE_NAMESPACE_SLUG for servicenames would be helpfull. If this variable is false, then the servicename should be named by groupnames like "MainGroup/SubGroup/MyRepository" (maybe with spaces, casesensitive ect.) and if this variable is true, then the servicename-creation should use slug-names for groups ...example: "mgroup/sgroup/myrepository"

Is this possible? Thanks!

dpacheconr commented 1 year ago

Hi

The GLAB_EXPORT_PATHS is intended to contain the full_path, up to the repository, so in your example you should configure it to MainGroup/SubGroup/ which should then generate GLAB_SERVICE_NAME=MainGroup/SubGroup/MyRepository

Have you tried that?

magicofit commented 1 year ago

I tested it, and its working! But now i have a dynamic situation. Everytime when a team is creating a subgroup in our company i have change the GLAB_EXPORT_PATHS-variable.

In our company we have stable 50 toplevel groups but only 27 groups should push infos to NewRelic. And some groups have up to 5 sub-groups....growing. But its working somehow with a loong GLAB_EXPORT_PATHS expression.

My second wish to take optionally slug-names instead of "names" of groups would help me to create more readable services. Because some of our subgroups have longer descriptions,specialchars&spaces in the subgroup-name. This option would be nice. :)

dpacheconr commented 1 year ago

@magicofit can you provide some examples how you believe that would work?

if I understood correctly if GLAB_TAKE_NAMESPACE_SLUG is set is to myslug, then MainGroup/SubGroup/MyRepository subgroup becomes myslug/MyRepositorysubgroup, but also that would mean that MainGroup/SubGroup0/MyRepositorysub0 will become myslug/MyRepositorysub0, the slug will apply to all groups/subgroups, is this the intentation?

I can't say we will implement this, but I can definitely look at it once we understood exactly what your requirements are

magicofit commented 1 year ago

Sure.

Right now the Servicesnames in NewRelic are for example: "Töp Level Group/Secönd Level Group/My Servicename" or "Töp Level Group/My Servicename"

And it should be (from my perspective) something like: "tlg/slg/my-servicename" or "tlg/my-servicename"

...with this glab_take_slug-option gitlab_groups