Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-24226

Prometheus metrics endpoint may be using more CPU than expected.

    XMLWordPrintable

    Details

      Description

      When calling the prometheus metrics endpoint /service/metrics/prometheus it is expected that this will be zero-cost CPU such that it simply returns precalculated values.

      It seems that there may be some analytics or other calculations performed at runtime that could scale in cost depending on the enviroment.

      For example each time the endpoint is called, a select is performed to count all records in the asset table per repository:

      2020-06-10 14:37:05,899-0500 DEBUG [qtp1842354020-50]  admin org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Opened database: component -> com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx@298e0ce0

      2020-06-10 14:37:05,900-0500 DEBUG [qtp1842354020-50]  admin org.sonatype.nexus.orient.entity.EntityHook - Unregistering OLiveQueryHook

      2020-06-10 14:37:05,901-0500 DEBUG [qtp1842354020-50]  admin org.sonatype.nexus.repository.storage.AssetEntityAdapter - Counting assets with query: select count from asset where (bucket=[54]:0), parameters: null

      2020-06-10 14:37:05,902-0500 DEBUG [qtp1842354020-50]  admin org.sonatype.nexus.orient.entity.EntityHook - Unregistering OLiveQueryHook

      2020-06-10 14:37:05,903-0500 DEBUG [qtp1842354020-50]  admin org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Opened database: component -> com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx@d5786b9

      2020-06-10 14:37:05,904-0500 DEBUG [qtp1842354020-50]  admin org.sonatype.nexus.orient.entity.EntityHook - Unregistering OLiveQueryHook

      2020-06-10 14:37:05,905-0500 DEBUG [qtp1842354020-50]  admin org.sonatype.nexus.repository.storage.AssetEntityAdapter - Counting assets with query: select count from asset where (bucket=[53]:0), parameters: null

      2020-06-10 14:37:05,906-0500 DEBUG [qtp1842354020-50]  admin org.sonatype.nexus.orient.entity.EntityHook - Unregistering OLiveQueryHook

      If this is the case, it would be beneficial for most monitoring to have at least two endpoints - one that is as close to zero-cost as possible, and one that has additional metrics as required - as many systems, especially cloud-hosted, may call the basic monitoring endpoint frequently as to provide a suitably granular level of monitoring and alerts.

      For example, Cloudwatch can now manage prometheus metrics.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mbucher Michael Bucher
              Reporter:
              mkearns Michael Kearns
              Last Updated By:
              Michael Prescott Michael Prescott
              Team:
              NXRM - Groot
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  tigCommentSecurity.panel-title