newrelic-experimental / gitlab

Gitlab exporters to send metrics,logs,traces to New Relic
11 stars 8 forks source link

Namespace Inconsistency with Metrics Export #18

Closed jared-hess closed 1 year ago

jared-hess commented 1 year ago

I've got the metrics export set up in a dedicated project pipeline, but I'm not clear on the expected behavior regarding which projects are selected based on the namespaces.

dpacheconr commented 1 year ago

Hi @jared-hess

The intend logic is, you define comma separate list of the namespaces/paths you will like to monitor via GLAB_EXPORT_PATHS, for example GLAB_EXPORT_PATHS=group1,group2 https://github.com/newrelic-experimental/gitlab/blob/main/new-relic-exporter-base/global_variables.py#L62:65 https://github.com/newrelic-experimental/gitlab/blob/a1f8fc45f66493957a83cc31acfe5f000b66da06/new-relic-metrics-exporter/get_resources.py#L34:35

The export path is usually everything up to the project name, in group root, it will be the group name, the json structure can be see here https://gitlab.com/api/v4/projects/TYPE_YOUR_PROJECT_ID_HERE/

Then for each of those paths we will look at each project in it using regex matching on it's name configured via GLAB_EXPORT_PROJECTS_REGEX, for example for all projects in each of those namespaces set it to GLAB_EXPORT_PROJECTS_REGEX=.*

The configuration above, should export data for root/group1/ANY_PROJECTS as well as root/group2/ANY_PROJECTS

Have you tried that?

I will double check the gitlab docs regarding CI_PROJECT_ROOT_NAMESPACE vs CI_PROJECT_NAMESPACE and update readme/code accordingly

If you think this logic can be improved or there is better way of doing it, please let us know or raise PR

dpacheconr commented 1 year ago

no reply for over 2 months please re-open if this is still an issue