Skip to content

Commit fefda3d

Browse files
authored
Merge branch 'main' into PORTN-3230-aggregation-by-path
2 parents dee20f0 + e8a45a6 commit fefda3d

File tree

5 files changed

+205
-36
lines changed

5 files changed

+205
-36
lines changed

docs/actions-and-automations/create-self-service-experiences/create-self-service-experiences.md

Lines changed: 186 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,189 @@ The basic structure of a self-service action looks like this (see key descriptio
165165

166166
## Examples
167167

168-
For complete examples of self-service actions using GitHub as the backend, check out the [guides section](/guides?tags=GitHub&tags=Actions).
168+
For complete examples of self-service actions using GitHub as the backend, check out the [guides section](/guides?tags=GitHub&tags=Actions).
169+
170+
## Track self-service actions
171+
172+
To gain visibility into how your self-service actions are being used and their performance, you can set up tracking for action runs. This allows you to monitor execution patterns, track success rates, and maintain audit trails to follow what actions were executed and when.
173+
174+
The following tracking system works by creating a dedicated blueprint for action runs and setting up an automation that captures execution details whenever a specific self-service action is triggered as well as an automation that updates the action run's status.
175+
176+
<h3>Set up data model</h3>
177+
178+
Create a blueprint for `Action run`:
179+
180+
1. Go to the [Data model](https://app.getport.io/settings/data-model) page of your portal.
181+
182+
2. Click on `+ Blueprint`.
183+
184+
3. Click on the `{...} Edit JSON` button in the top right corner.
185+
186+
4. Copy and paste the following JSON schema, then click `Save`.
187+
188+
<details>
189+
<summary><b>Action run blueprint (click to expand)</b></summary>
190+
191+
``` json
192+
{
193+
"identifier": "action_run",
194+
"title": "Action run",
195+
"icon": "Microservice",
196+
"schema": {
197+
"properties": {
198+
"status": {
199+
"icon": "DefaultProperty",
200+
"title": "Status",
201+
"type": "string",
202+
"enum": [
203+
"SUCCESS",
204+
"FAILURE",
205+
"IN_PROGRESS",
206+
"WAITING_FOR_APPROVAL",
207+
"DECLINED"
208+
],
209+
"enumColors": {
210+
"SUCCESS": "green",
211+
"FAILURE": "red",
212+
"IN_PROGRESS": "lightGray",
213+
"WAITING_FOR_APPROVAL": "yellow",
214+
"DECLINED": "red"
215+
}
216+
},
217+
"created_at": {
218+
"type": "string",
219+
"title": "Created At",
220+
"format": "date-time"
221+
},
222+
"run_id": {
223+
"type": "string",
224+
"title": "Run ID"
225+
},
226+
"run_url": {
227+
"type": "string",
228+
"title": "Run URL",
229+
"format": "url"
230+
},
231+
"updated_at": {
232+
"type": "string",
233+
"title": "Updated At",
234+
"format": "date-time"
235+
},
236+
"action": {
237+
"type": "string",
238+
"title": "Action"
239+
}
240+
},
241+
"required": []
242+
},
243+
"mirrorProperties": {},
244+
"calculationProperties": {},
245+
"aggregationProperties": {},
246+
"relations": {}
247+
}
248+
```
249+
</details>
250+
251+
252+
<h3>Define the automation</h3>
253+
254+
The following automation updates the `Action run` entity with information regarding this run.
255+
To add it, follow these steps:
256+
257+
1. Go to the [Automations](https://app.getport.io/settings/automations) page of your portal.
258+
259+
2. Click on the `+ Automation` button.
260+
261+
3. Click on the `{...} Edit JSON` button in the top right corner.
262+
263+
4. Copy and paste the following JSON configuration into the editor, then click `Save`.
264+
265+
<details>
266+
<summary><b>Update `Action run` automation definition (click to expand)</b></summary>
267+
268+
``` json
269+
{
270+
"identifier": "update_action_run",
271+
"title": "Update Action Run",
272+
"description": "",
273+
"trigger": {
274+
"type": "automation",
275+
"event": {
276+
"type": "ANY_RUN_CHANGE",
277+
"actionIdentifier": "<THE_ACTION_IDENTIFIER>"
278+
},
279+
"condition": {
280+
"type": "JQ",
281+
"expressions": [],
282+
"combinator": "and"
283+
}
284+
},
285+
"invocationMethod": {
286+
"type": "UPSERT_ENTITY",
287+
"blueprintIdentifier": "action_run",
288+
"mapping": {
289+
"identifier": "{{.event.diff.after.id}}",
290+
"title": "{{.event.diff.after.id}}",
291+
"properties": {
292+
"run_id": "{{.event.diff.after.id}}",
293+
"run_url": "https://app.port.io/organization/run?runId={{.event.diff.after.id}}",
294+
"status": "{{.event.diff.after.status}}",
295+
"created_at": "{{.event.diff.after.createdAt}}",
296+
"updated_at": "{{.event.diff.after.updatedAt}}",
297+
"action": "{{.event.diff.after.action.title}}"
298+
},
299+
"relations": {}
300+
}
301+
},
302+
"publish": true
303+
}
304+
```
305+
</details>
306+
307+
Once implemented, you can track your self-service action runs and see how they are progressing.
308+
309+
For example, you can create the following widget to vizualize how `Action runs` are distributed by status for a specific `Action` over the past month:
310+
311+
1. Click **`+ Widget`** and select **Pie chart**.
312+
313+
2. Give the widget a `title` and a `description`.
314+
315+
3. Choose the `Action run` blueprint.
316+
317+
4. Under `Breakdown by property`, select the **status** property.
318+
319+
5. Under `Additional filters` you can choose to filter by:
320+
- `Action runs` that were created in the past month.
321+
- `Action runs` of a specific self-service action.
322+
323+
Click on `filters`, then on `{...} Edit JSON`, and add the following snippet with your action title and relevant time frame.
324+
Below is a JSON example for `Create s3 bucket` self-service action in the past month:
325+
326+
<details>
327+
<summary><b>filters JSON example (click to expand)</b></summary>
328+
``` json showLineNumbers
329+
{
330+
"combinator": "and",
331+
"rules": [
332+
{
333+
"property": "created_at",
334+
"operator": "between",
335+
"value": {
336+
"preset": "lastMonth"
337+
}
338+
},
339+
{
340+
"property": "action",
341+
"operator": "=",
342+
"value": "Create s3 bucket" // Change the value to your action name
343+
}
344+
]
345+
}
346+
```
347+
</details>
348+
349+
6. Click `Save`.
350+
351+
This will result in a widget similar to the following:
352+
353+
<img src='/img/self-service-actions/actionRunsPieChartExample.png' width='70%' border='1px' />

docs/actions-and-automations/create-self-service-experiences/setup-the-backend/setup-the-backend.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ For example, say we have an action with one user input that is the user's name.
5757
}
5858
```
5959

60+
:::info `.run` available values
61+
When the action is triggered, the `.run` object includes only the run `id`.
62+
:::
63+
6064
You may have noticed that the example above also sends `{{ .run.id }}`. This is a unique identifier for each execution of the action, and can be used to interact with the action run in Port from your backend.
6165

6266
Now you might be thinking - *how do I know what data is available to me when constructing the payload?*

docs/actions-and-automations/define-automations/setup-action.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ Here is an example for an automation payload:
4646
}
4747
```
4848

49-
You may have noticed that the example above also sends `{{ .run.id }}`. This is a unique identifier for each execution of the automation, and can be used to interact with the autmation run in Port from your backend.
49+
:::info `.run` available values
50+
When the automation is triggered, the `.run` object includes only the run `id`.
51+
:::
52+
53+
You may have noticed that the example above also sends `{{ .run.id }}`. This is a unique identifier for each execution of the automation, and can be used to interact with the automation run in Port from your backend.
5054

5155
Now you might be thinking - *how do I know what data is available to me when constructing the payload?*
5256
Enter `trigger data`.

docs/search-and-query/comparison-operators.md

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -249,39 +249,15 @@ The `notBetween` operator checks datetime values and returns entities whose rele
249249

250250
### contains
251251

252-
The `contains` operator compares string properties based on the target property type:
253-
254-
<Tabs values={[
255-
{label: "String property", value: "stringProp"},
256-
{label: "Array property", value: "arrayProp"}
257-
]}>
258-
259-
<TabItem value="stringProp">
260-
When used on a string property, the operator will check if the value is contained inside the property:
252+
The `contains` operator checks if the specified value exists within a string property:
261253

262254
```json showLineNumbers
263255
{
264256
"property": "myStringProperty",
265-
"operator": "myStringProperty",
266-
"value": "mySubString"
267-
}
268-
```
269-
270-
</TabItem>
271-
272-
<TabItem value="arrayProp">
273-
When used on a string array property, the operator will check if the value is equal to one of the strings in the array:
274-
275-
```json showLineNumbers
276-
{
277-
"property": "myStringArrayProp",
278257
"operator": "contains",
279-
"value": "myString"
258+
"value": "mySubString"
280259
}
281260
```
282-
</TabItem>
283-
284-
</Tabs>
285261

286262
### doesNotContains
287263

@@ -297,7 +273,7 @@ The `contains` operator checks if the specified value **does not** exists in the
297273

298274
### containsAny
299275

300-
The `containsAny` operator checks if **any** of the specified strings exist in the target array:
276+
The `containsAny` operator checks if **any** of the specified strings exist in the target **array**:
301277

302278
```json showLineNumbers
303279
{
@@ -309,7 +285,7 @@ The `containsAny` operator checks if **any** of the specified strings exist in t
309285

310286
### beginsWith
311287

312-
The `beginsWith` operator checks if the specified property starts with the specified value**
288+
The `beginsWith` operator checks if the specified property starts with the specified value:
313289

314290
```json showLineNumbers
315291
{
@@ -321,7 +297,7 @@ The `beginsWith` operator checks if the specified property starts with the speci
321297

322298
### doesNotBeginsWith
323299

324-
The `doesNotBeginsWith` operator checks if the specified property **does not** start with the specified value
300+
The `doesNotBeginsWith` operator checks if the specified property **does not** start with the specified value:
325301

326302
```json showLineNumbers
327303
{
@@ -333,7 +309,7 @@ The `doesNotBeginsWith` operator checks if the specified property **does not** s
333309

334310
### endsWith
335311

336-
The `endsWith` operator checks if the specified property ends with the specified value
312+
The `endsWith` operator checks if the specified property ends with the specified value:
337313

338314
```json showLineNumbers
339315
{
@@ -345,7 +321,7 @@ The `endsWith` operator checks if the specified property ends with the specified
345321

346322
### doesNotEndsWith
347323

348-
The `doesNotEndsWith` operator checks if the specified property **does not** end with the specified value
324+
The `doesNotEndsWith` operator checks if the specified property **does not** end with the specified value:
349325

350326
```json showLineNumbers
351327
{
@@ -357,7 +333,7 @@ The `doesNotEndsWith` operator checks if the specified property **does not** end
357333

358334
### in
359335

360-
The `in` operator checks if a `string` property is equal to one or more specified `string` values
336+
The `in` operator checks if a `string` property is equal to one or more specified `string` values:
361337

362338
<Tabs values={[
363339
{label: "Standard", value: "array"},
@@ -378,7 +354,7 @@ The `in` operator checks if a `string` property is equal to one or more specifie
378354

379355
<TabItem value="myTeamsDynamicFilter">
380356

381-
In order to filter entities that **belong to one or more of your teams** you can use the special `My Teams` filter.
357+
In order to filter entities that **belong to one or more of your teams** you can use the special `My Teams` filter:
382358

383359
```json showLineNumbers
384360
{
@@ -398,7 +374,7 @@ You can also use the `My Teams` filter in the UI:
398374

399375
### notIn
400376

401-
The `notIn` operator checks if a `string` property is **not equal** to all of the specified `string` values
377+
The `notIn` operator checks if a `string` property is **not equal** to all of the specified `string` values:
402378

403379
```json showLineNumbers
404380
{
76.6 KB
Loading

0 commit comments

Comments
 (0)