Operational Analytics Plugin for Spinnaker

The Operational Analytics Plugin for Spinnaker and Armory Continuous Deployment automates the aggregation of successful pipeline count by day and makes the information available to query and visualize through an API.

Proprietary Generally available

What the Operational Analytics plugin does

Armory’s Operational Analytics plugin for Spinnaker and Armory CD adds functionality to Orca that enables the storage of new metrics in Orca. You can retrieve those metrics using the API. The plugin is designed to provide key performance indicators without adding more services or operational overhead to the Spinnaker cluster to which it is installed.

Before you begin

  • Your Orca service must use a SQL backend. See Orca configured with SQL backend for instructions.
  • You’re able to call Orca’s service endpoint (by default http://spin-orca:8083)

Compatibility matrix

Armory CD VersionSpinnaker VersionArmory Insights Plugin Version
2.31.x1.31.x1.0.0
2.30.x1.29.x, 1.30.x1.0.0
2.28.x1.28.x1.0.0

Install the plugin

  1. In your spinnaker-kustomize-patches/plugins directory, create an operational-analytics-plugin.yml file with the following contents:

    apiVersion: spinnaker.armory.io/v1alpha2
    kind: SpinnakerService
    metadata:
      name: spinnaker
    spec:
      spinnakerConfig:
        profiles:
          spinnaker:
            insights:
              jobs:
                pipelineStatusCount:
                  cron: '1 1 1 * * *'              
            spinnaker:
              extensibility:
                repositories:
                  repository:
                    enabled: true
                    url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
          orca:
            spinnaker:
              extensibility:
                plugins:
                  Armory.Insights:
                    version: <version>
                    enabled: true
                  extensions:
                    armory.insights:
                      enabled: true
    
    • version: Replace <version> with the plugin version compatible with your Spinnaker version.
    • insights.jobs.pipelineStatusCount.cron: Replace with a cron expression that corresponds to the time of the day with lowest load. You can disable this field by using - as the expression. For example:
    spec:
     spinnakerConfig:
       profiles:
         spinnaker:
           insights:
             jobs:
               pipelineStatusCount:
                 cron: '-' 
    
  2. Add the plugin patch to your Kustomize recipe’s patchesStrategicMerge section. For example:

    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    
    namespace: spinnaker
    
    components:
      - core/base
      - core/persistence/in-cluster
      - targets/kubernetes/default
    
    patchesStrategicMerge:
      - core/patches/oss-version.yml
      - plugins/operational-analytics-plugin.yml
    
    patches:
      - target:
          kind: SpinnakerService
        path: utilities/switch-to-oss.yml
    
  3. Apply the updates to your Kustomization recipe.

    kubectl apply -k <kustomization-directory-path>
    
  1. In your spinnaker-kustomize-patches/plugins/oss directory, create an operational-analytics-plugin.yml file with the following contents:

    apiVersion: spinnaker.io/v1alpha2
    kind: SpinnakerService
    metadata:
      name: spinnaker
    spec:
      spinnakerConfig:
        profiles:
          spinnaker:
            insights:
              jobs:
                pipelineStatusCount:
                  cron: '1 1 1 * * *'              
            spinnaker:
              extensibility:
                repositories:
                  repository:
                    enabled: true
                    url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
          orca:
            spinnaker:
              extensibility:
                plugins:
                  Armory.Insights:
                    version: <version>
                    enabled: true
                  extensions:
                    armory.insights:
                      enabled: true
    
    • version: Replace <version> with the plugin version compatible with your Spinnaker version.
    • insights.jobs.pipelineStatusCount.cron: Replace with a cron expression that corresponds to the time of the day with lowest load. You can disable this field by using - as the expression. For example:
    spec:
     spinnakerConfig:
       profiles:
         spinnaker:
           insights:
             jobs:
               pipelineStatusCount:
                 cron: '-' 
    
  2. Add the plugin patch to your Kustomize recipe’s patchesStrategicMerge section.

    For example:

    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    
    namespace: spinnaker
    
    components:
      - core/base
      - core/persistence/in-cluster
      - targets/kubernetes/default
    
    patchesStrategicMerge:
      - core/patches/oss-version.yml
      - plugins/oss/operational-analytics-plugin.yml
    
    patches:
      - target:
          kind: SpinnakerService
        path: utilities/switch-to-oss.yml
    
  3. Apply the updates to your Kustomization recipe.

    kubectl apply -k <kustomization-directory-path>
    

The Operational Analytics plugin extends Orca. You should create or update the extended service’s local profile in the same directory as the other Halyard configuration files. This is usually ~/.hal/default/profiles on the machine where Halyard is running.

insights:
  jobs:
    pipelineStatusCount:
      cron: '1 1 1 * * *' 
      
spinnaker:
  extensibility:
    plugins:
      Armory.Insights:
        version: <version>
          enabled: true
      extensions:
        armory.insights:
          enabled: true
      repositories:
        repository:
          enabled: true
          url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json
  • version: Replace <version> with the plugin version compatible with your Spinnaker version.
  • insights.jobs.pipelineStatusCount.cron: Replace with a cron expression that corresponds to the time of the day with lowest load. You can disable this field by using - as the expression. For example:
insights:
  jobs:
    pipelineStatusCount:
      cron: '-' 

Save your file and apply your changes by running hal deploy apply.

How to use the plugin

API endpoint

/insights/pipelines/statuses/count

ParameterTypeDescriptionOptionalDefault Value
fromDate (yyyy-MM-dd)Starting DateYes30 days ago
toDate (yyyy-MM-dd)End DateYesToday
limitNumberMax Number of resultsYes1000
offsetIdNumberStarting Id (Exclusive)Yesnil
descOrderBooleanSort results in descending orderYesfalse
statusSUCCEEDED | TERMINALStatus of the aggregateYesSUCCEEDED

JSON Response

{
    "records": [
        {
            "id": [id],
            "status": "[status]",
            "date": [UNIX milliseconds],
            "count": [count],
            "day": "yyyy-MM-dd"
        },
        ...
    ],
    "limit": [limit],
    "count": [count],
    "from": "yyyy-MM-dd",
    "to": "yyyy-MM-dd"
}

Root object

FieldTypeDescription
recordsArrayArray of record objects
limitNumberLimit on the number of records
countNumberTotal number of records
fromStringStart date for the record collection
toStringEnd date for the record collection

Record object

Each object in the records array has the following structure:

FieldTypeDescription
idNumberUnique identifier of the record
statusStringStatus of the record (e.g., “SUCCEEDED”)
dateNumberDate of the record in milliseconds since epoch
countNumberCount associated with the record
dayStringThe day corresponding to the record (yyyy-MM-dd format)

Last modified December 13, 2023: (69a0e06c)