You can use GitView’s api to create custom datapoints inside the GitView system which you can then leverage inside of alerts and reports.
Examples of how you might leverage this include:
- Track c.i. restarts to determine how flakey your test suite is and how much development is being wasted waiting on flakey tests
- Track deployments and deployment failures
- Insert custom data into the system from external platforms that GitView does not yet support
Api Documentation
Grab your API key from the Billing and Other Settings section of GitView. If you don’t see it enabled, make sure you contact support@gitview.com or message in the intercom to get access.
Custom Data Point Schema
rubyt.text "tag", null: false # Required tag i.e. Deploy, Test Flake, or C.I Restart t.datetime "datetime" # Optional datetime to provide, defaults to current server time t.decimal "decimal" # Optional number to provide i.e. 100, 5.3, or 0.10 t.boolean "boolean" # Optional boolean if tracking if something occured or didn't occur t.text "metadata" # Optional metadata for reference t.uuid "organization_id", null: false # Added automatically, not overridable t.datetime "created_at", null: false # Added automatically, not overridable t.datetime "updated_at", null: false # Updated automatically, not overridable t.datetime "soft_deleted_at" # Optional if you want to leave data around without deleting
Create Example
rubycurl -X POST "http://app.gitview.com/custom_data_points" \ -H "Content-Type: application/json" \ -d '{ "api_key": "<your uuid key here>", "tag": "deploy", }'
or alternatively, a one liner approach (easy to use within C.I. setups):
rubycurl -X POST "http://app.gitview.com/custom_data_points?api_key=<your uuid key here>&tag=deploy"
Update Example
rubycurl -X PUT "http://app.gitview.com/custom_data_points/<custom data point id>" \ -H "Content-Type: application/json" \ -d '{ "api_key": "<your uuid key here>", "decimal": 3.0, }'
Delete Example
If you’d like to soft delete a record, you can simply update it with the soft_deleted_at value. Just be sure to filer them out in your queries.
rubycurl -X PUT "http://app.gitview.com/custom_data_points/<custom data point id>" \ -H "Content-Type: application/json" \ -d '{ "api_key": "<your uuid key here>", "soft_deleted_at": "2024-01-01", }'
To hard delete the record, you can use the DELETE endpoint:
rubycurl -X DELETE "http://app.gitview.com/custom_data_points/<custom data point id>?api_key=<your uuid key here>"
Index Example
If you’d like to search across your custom data records, for the purpose of updating or deleting them, you can do so with the index endpoint
rubycurl "http://app.gitview.com/custom_data_points?api_key=<your uuid key here>"
Pagination
The response will include the data as well as pagination information. The page numbers use zero-base indexing.
ruby{ "data": [{ "id": "a94db3f7-e3fd-4c86-ab09-e66c79bf238c", "tag": "deploy", "datetime": "2023-05-21T20:48:21.331Z", "decimal": "3.0", "boolean": null, "metadata": null, "organization_id": "3f637416-b8b4-4734-bf42-0262b3462248", "created_at": "2023-05-21T20:48:21.531Z", "updated_at": "2023-05-21T20:56:55.184Z", "soft_deleted_at": "2023-05-21T20:48:21.000Z" }], "pagination_info": { "page": 0, "limit": 2 } }
To request the next page, simply provide the page number
rubycurl "http://app.gitview.com/custom_data_points?api_key=<your uuid key here>&page=1"
Filtering
If you need to filter by specific attribute you can do so using the various filters that are available:
- tag
- datetime
- decimal
- boolean
- metadata - exact match
- metadata_search - partial match
- created_at
- updated_at
- soft_deleted_at
- datetime_min
- datetime_max
- created_at_min
- created_at_max
- updated_at_min
- updated_at_max
- soft_deleted_at_min
- soft_deleted_at_max
- decimal_min
- decimal_max
For example, this is how you would find all deploys tags created between two dates and who’s metadata contains a specific key word
rubycurl "http://app.gitview.com/custom_data_points?tag=deploy&metadata_search=alpha&created_at_min=2021-01-01&created_at_max=2023-01-01&api_key=<your uuid key here>"