|
| 1 | +--- |
| 2 | +title: Armory Insights Plugin for Armory CD |
| 3 | +linkTitle: Armory Insights |
| 4 | +description: > |
| 5 | + The Armory Insights Plugin for Armory Continuous Deployment automates the aggregation of successful pipeline count by day and makes the information available to query and visualize through an API. |
| 6 | +no_list: true |
| 7 | +--- |
| 8 | + |
| 9 | + []({{< ref "release-definitions#ga" >}}) |
| 10 | + |
| 11 | +**Armory Continuous Deployment only** |
| 12 | + |
| 13 | +## {{% heading "prereq" %}} |
| 14 | + |
| 15 | +* Your Orca service uses a SQL backend. See [Orca configured with SQL backend]({{< ref "continuous-deployment/armory-admin/orca-sql-configure" >}}) for instructions. |
| 16 | +* You're able to call Orca's service endpoint (by default `http://spin-orca:8083`) |
| 17 | + |
| 18 | +## Compatibility matrix |
| 19 | + |
| 20 | +| Armory CD Version | Armory Insights Plugin Version | |
| 21 | +|-------------------|-----------------------------| |
| 22 | +| 2.31.x | 0.0.1 | |
| 23 | +| 2.30.x | 0.0.1 | |
| 24 | +| 2.28.x | 0.0.1 | |
| 25 | + |
| 26 | +## Installation |
| 27 | + |
| 28 | +### Configure the plugin |
| 29 | + |
| 30 | +In your `spinnaker-kustomize-patches/plugins` directory, create an `insights-plugin.yml` file with the following contents: |
| 31 | + |
| 32 | +```yaml |
| 33 | +apiVersion: spinnaker.armory.io/v1alpha2 |
| 34 | +kind: SpinnakerService |
| 35 | +metadata: |
| 36 | + name: spinnaker |
| 37 | +spec: |
| 38 | + spinnakerConfig: |
| 39 | + profiles: |
| 40 | + spinnaker: |
| 41 | + insights: |
| 42 | + jobs: |
| 43 | + pipelineStatusCount: |
| 44 | + cron: '1 1 1 * * *' |
| 45 | + spinnaker: |
| 46 | + extensibility: |
| 47 | + repositories: |
| 48 | + repository: |
| 49 | + enabled: true |
| 50 | + url: https://raw.githubusercontent.com/armory-plugins/pluginRepository/master/repositories.json |
| 51 | + orca: |
| 52 | + spinnaker: |
| 53 | + extensibility: |
| 54 | + plugins: |
| 55 | + Armory.Insights: |
| 56 | + version: <version> |
| 57 | + enabled: true |
| 58 | + extensions: |
| 59 | + armory.insights: |
| 60 | + enabled: true |
| 61 | +``` |
| 62 | +
|
| 63 | +- `version`: Replace `<version>` with the plugin version compatible with your Spinnaker version. |
| 64 | +- `insights.jobs.pipelinStatusCount.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: |
| 65 | + |
| 66 | + ```yaml |
| 67 | + spec: |
| 68 | + spinnakerConfig: |
| 69 | + profiles: |
| 70 | + spinnaker: |
| 71 | + insights: |
| 72 | + jobs: |
| 73 | + pipelineStatusCount: |
| 74 | + cron: '-' |
| 75 | + ``` |
| 76 | + |
| 77 | +### Install the plugin |
| 78 | + |
| 79 | +1. Add the plugin patch to your Kustomize recipe's `patchesStrategicMerge` section. For example: |
| 80 | + |
| 81 | + {{< highlight yaml "linenos=table,hl_lines=13" >}} |
| 82 | + apiVersion: kustomize.config.k8s.io/v1beta1 |
| 83 | + kind: Kustomization |
| 84 | + |
| 85 | + namespace: spinnaker |
| 86 | + |
| 87 | + components: |
| 88 | + - core/base |
| 89 | + - core/persistence/in-cluster |
| 90 | + - targets/kubernetes/default |
| 91 | + |
| 92 | + patchesStrategicMerge: |
| 93 | + - core/patches/oss-version.yml |
| 94 | + - plugins/insights-plugin.yml |
| 95 | + |
| 96 | + patches: |
| 97 | + - target: |
| 98 | + kind: SpinnakerService |
| 99 | + path: utilities/switch-to-oss.yml |
| 100 | + {{< /highlight >}} |
| 101 | + |
| 102 | +1. Apply the updates to your Kustomization recipe. |
| 103 | + |
| 104 | + ```bash |
| 105 | + kubectl apply -k <kustomization-directory-path> |
| 106 | + ``` |
| 107 | + |
| 108 | +## How to use the plugin |
| 109 | + |
| 110 | +### API endpoint |
| 111 | + |
| 112 | +`/insights/pipelines/statuses/count` |
| 113 | + |
| 114 | +| Parameter | Type | Description | Optional | Default Value | |
| 115 | +|-----------|-----------------------|----------------------------------|----------|---------------| |
| 116 | +| from | Date (yyyy-MM-dd) | Starting Date | Yes | 30 days ago | |
| 117 | +| to | Date (yyyy-MM-dd) | End Date | Yes | Today | |
| 118 | +| limit | Number | Max Number of results | Yes | 1000 | |
| 119 | +| offsetId | Number | Starting Id (Exclusive) | Yes | nil | |
| 120 | +| descOrder | Boolean | Sort results in descending order | Yes | false | |
| 121 | +| status | SUCCEEDED \| TERMINAL | Status of the aggregate | Yes | SUCCEEDED | |
| 122 | + |
| 123 | +### JSON Response |
| 124 | + |
| 125 | +```json |
| 126 | +{ |
| 127 | + "records": [ |
| 128 | + { |
| 129 | + "id": [id], |
| 130 | + "status": "[status]", |
| 131 | + "date": [UNIX milliseconds], |
| 132 | + "count": [count], |
| 133 | + "day": "yyyy-MM-dd" |
| 134 | + }, |
| 135 | + ... |
| 136 | + ], |
| 137 | + "limit": [limit], |
| 138 | + "count": [count], |
| 139 | + "from": "yyyy-MM-dd", |
| 140 | + "to": "yyyy-MM-dd" |
| 141 | +} |
| 142 | +``` |
| 143 | + |
| 144 | +#### Root object |
| 145 | + |
| 146 | +| Field | Type | Description | |
| 147 | +|---------|--------|--------------------------------------| |
| 148 | +| records | Array | Array of record objects | |
| 149 | +| limit | Number | Limit on the number of records | |
| 150 | +| count | Number | Total number of records | |
| 151 | +| from | String | Start date for the record collection | |
| 152 | +| to | String | End date for the record collection | |
| 153 | + |
| 154 | +#### Record object |
| 155 | + |
| 156 | +Each object in the `records` array has the following structure: |
| 157 | + |
| 158 | +| Field | Type | Description | |
| 159 | +|--------|--------|---------------------------------------------------------| |
| 160 | +| id | Number | Unique identifier of the record | |
| 161 | +| status | String | Status of the record (e.g., "SUCCEEDED") | |
| 162 | +| date | Number | Date of the record in milliseconds since epoch | |
| 163 | +| count | Number | Count associated with the record | |
| 164 | +| day | String | The day corresponding to the record (yyyy-MM-dd format) | |
| 165 | + |
0 commit comments