Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55223

unable to create a metricskey via the api

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • metrics-plugin
    • None

      Hello,

      I am unable to use the dedicated method setAccessKeys() to add a new metric key.
      -> the goal is to define the key via the code instead of overriding the generated xml file.

       

      def monitoringKey = new jenkins.metrics.api.MetricsAccessKey ("jenkins_metrics", "monitoring", true, false, true, true, null)
      List<jenkins.metrics.api.MetricsAccessKey> metricKeys = new ArrayList<jenkins.metrics.api.MetricsAccessKey> ()
      metricKeys.add (monitoringKey)
      jenkins.metrics.api.MetricsAccessKey.DescriptorImpl.setAccessKeys (metricKeys)

       

      result:

      groovy.lang.MissingMethodException: No signature of method: static jenkins.metrics.api.MetricsAccessKey$DescriptorImpl.setAccessKeys() is applicable for argument types: (java.util.ArrayList) values: [[MetricsAccessKey\{key='monitoring', description='jenkins_metrics', canPing=true, canHealthCheck=true, canMetrics=true, canThreadDump=false, origins='null'}]]
      Possible solutions: setAccessKeys(java.util.List), getAccessKeys(), getAccessKey(java.lang.String)

       

            Unassigned Unassigned
            amatignon arnold matignon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: