Closed jared-hess closed 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
no reply for over 2 months please re-open if this is still an issue
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.
GLAB_EXPORT_PATHS
should default to the value ofCI_PROJECT_ROOT_NAMESPACE
if running in a pipeline, but we can see here it actually defaults toCI_PROJECT_NAMESPACE
. https://github.com/newrelic-experimental/gitlab/blob/a1f8fc45f66493957a83cc31acfe5f000b66da06/new-relic-exporter-base/global_variables.py#L60GLAB_EXPORT_PROJECTS_REGEX
. See here: https://github.com/newrelic-experimental/gitlab/blob/a1f8fc45f66493957a83cc31acfe5f000b66da06/new-relic-metrics-exporter/get_resources.py#L36-L37 So if we have projects named like "root/group1/project1" and "root/group2/project2", I'm unable to specify all projects under "root" namespace and instead have to specify "root/group1" and "root/group2" explicitly, which in my case is not practical. Is this the intended behavior? My assumption originally was that the namespace would match the project path as a prefix, not an exact match.