getsentry / getsentry/sentry

Make issues' annotations editable via the REST API; add them again in the issue detail page heading

Open
#46,623 3 comments 5 reactions 0 assignees View on GitHub
Component: Integrations
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
1d 5h
Merged PRs (30d)
624

Description

### Problem Statement

Since your native Redmine integration is not maintained anymore and functions seem to be removed without replacement, this seriously limits the ability to efficiently track and manage exceptions in external trackers (like Redmine is), as well while navigating the Sentry UI.

The most prominent issues are: Existing issues cant be linked anymore, only new ones created. Annotations (With it the links to Redmine issues) are not in the header of the issue detail page anymore, like they used to be for many years - the workaround is to search for an entry in the activities tab. Redmine links (Annotations in general, i guess) cant be modified nor deleted once created.

PS: I know from previous submitted issues that you don't regard Redmine as being relevant because your SaaS clients rarely use this integration. Redmine is around since 16 years with an active developer community - without counting the zip downloads from their HP or the svn/git checkouts, looking at its Docker Hub page, it shows 50M+ downloads. Chances are that most people who host Redmine themselves also host Sentry themselves, so I can understand that Redmine will never be a priority based for your paying SaaS customers, thus all I am asking is for a way to work with what is already there.

### Solution Brainstorm

To have control over the annotations of an issue (in my case the link to the Redmine issue) it would be very helpful to be able to edit the `annotations` field over the Sentry API, either over a new annotations endpoint, or over the existing issues endpoint. These changes should also be reflected in the activity log. The details of this change are of course up to you, though i have 2 suggestions:

### a) A dedicated `annotations` endpoint to manage annotations in a RESTful way

- `GET https://sentry.io/api/0/issues/{issue_id}/annotations/` - lists all issues' annotations
- `POST https://sentry.io/api/0/issues/{issue_id}/annotations/` - creates a new annotation for the issue
- `GET https://sentry.io/api/0/issues/{issue_id}/annotations/{annotation_id}` - get the annotation (`annotation_id` can be the positional number in the array or a real ID from DB)
- `DELETE https://sentry.io/api/0/issues/{issue_id}/annotations/{annotation_id}` - deletes the annotation (`annotation_id` can be the positional number in the array or a real ID from DB)
- `PUT https://sentry.io/api/0/issues/{issue_id}/annotations/{annotation_id}` - updates the annotation (`annotation_id` can be the positional number in the array or a real ID from DB)

With these payloads it would also be ideal to add information to the newly created activity entry. As an example: The new activity types could be `delete_annotation`, `create_annotation`, `update_annotation` and they could use the hypothetical payloads' `activity_message` field to store some information related to the action. A few examples:

To delete tracker issue relations:

```shell
$ curl https://sentry.io/api/0/issues/{issue_id}/annotations/{annotation_id}/ \
-H 'Authorization: Bearer ' \
-X DELETE \
-H 'Content-Type: application/json' \
-d '{"activity_message": "Issue #123 was closed in Redmine, removed relation" }'
```

To be able to manage tracker issue duplicates:

```shell
$ curl https://sentry.io/api/0/issues/{issue_id}/annotations/{annotation_id}/ \
-H 'Authorization: Bearer ' \
-X PUT \
-H 'Content-Type: application/json' \
-d '{"content": "' \
-X POST \
-H 'Content-Type: application/json' \
-d '{"content": "
' \
-X PUT \
-H 'Content-Type: application/json' \
-d '{"annotations": [], "activity_message": "Issue #123 was closed in Redmine, removed relation" }'
```

To change the annotations to contain a link to an issue:

```shell
$ curl https://sentry.io/api/0/issues/{issue_id}/ \
-H 'Authorization: Bearer ' \
-X PUT \
-H 'Content-Type: application/json' \
-d '{"annotations": ["

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.