Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

docs(issue-platform): Update docs from issue platform support additions #1079

Merged
merged 11 commits into from
Nov 9, 2023
37 changes: 23 additions & 14 deletions src/docs/issue-platform.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ You may also set these optional attributes:
- `noise_config`: A `NoiseConfig` that allows you to set policy on how many times a fingerprint must occur in a period of time before an issue is created. NoiseConfig has two attributes:
- `ignore_limit`: How many occurrences need to occur before we create a new issue
- `expiry_time`: The period of time the occurrences must occur in before we reset the count
- `enable_auto_resolve`: Whether detector controlled resolution should be enabled for this issue type. By default this attribute is set to true.
- `enable_escalation_detection`: Whether escalation forecasts and detection should be enabled for this issue type. By default this attribute is set to true.
- `enable_auto_resolve`: Whether this issue type can be resolved automatically after 14 days of silence. By default this attribute is set to true.
17hogeju marked this conversation as resolved.
Show resolved Hide resolved
17hogeju marked this conversation as resolved.
Show resolved Hide resolved
- `enable_escalation_detection`: Whether this issue type can escalate using the <Link to="https://docs.sentry.io/product/issues/states-triage/escalating-issues/">Escalating Issues Algorithm</Link>. By default this attribute is set to true.

Here's an example issue type:
```python
Expand All @@ -55,8 +55,13 @@ class ProfileFileIOGroupType(GroupType):
### Register a Category
You might also want to register a new category related to your issue type as well. This allows you to group related issue types together. To do so, add your category to <Link to="https://github.com/getsentry/sentry/blob/97f4174c28041357aa190f27012dc33c1c7bafc7/src/sentry/issues/grouptype.py#L17-L22">this enum</Link>

## Send Occurrences to the Issue Platform
If operating within the Sentry codebase, you can call <Link to="https://github.com/getsentry/sentry/blob/master/src/sentry/issues/producer.py#L41-L46">sentry.issues.produce_occurrence_to_kafka</Link> and pass in the <Link to="https://github.com/getsentry/sentry/blob/d262bbd9d8d3a2747d5251bee35c016c13ca050a/src/sentry/issues/issue_occurrence.py#L58">IssueOccurrence</Link> and optionally the `Event` data, <Link to="#payload-type">`Payload Type`</Link>, and <Link to="#status-change">`status_change`</Link>. The fields in these are described in the schemas below.
## Send Occurrence or Status Change Payloads to the Issue Platform
If operating within the Sentry codebase, you can call <Link to="https://github.com/getsentry/sentry/blob/master/src/sentry/issues/producer.py#L41-L46">sentry.issues.produce_occurrence_to_kafka</Link> with the following optional parameters:
- `payload_type`: <Link to="#payload-type">PayloadType</Link>
- `occurrence`: <Link to="https://github.com/getsentry/sentry/blob/d262bbd9d8d3a2747d5251bee35c016c13ca050a/src/sentry/issues/issue_occurrence.py#L58">IssueOccurrence</Link>
- `status_change`: <Link to="#status-change-message">StatusChangeMessage</Link>
- `event_data`: Dict[str, Any]


If operating from an external service then pass a json payload that matches the <Link to="#issue-occurrence-schema">Issue Occurrence Schema</Link> to the `ingest-occurrences` topic on the <Link to="https://github.com/getsentry/getsentry/blob/97039335a29517a7e48149148cdd7a30a60971e7/getsentry/conf/settings/prod.py#L567-L571">issue occurrences Kafka cluster</Link>

Expand Down Expand Up @@ -121,19 +126,23 @@ Caveats
- Attachments will not work. If you have a need for this please contact the issues team.

### Payload Type
<Link to="https://github.com/getsentry/sentry/blob/ccfb37212102945df5f35e8f55fe38891b70036b/src/sentry/issues/producer.py#L23">PayloadType</Link>
Determines the type of payload sent to the issue platform. If `payload_type` is not present in `produce_occurrence_to_kafka`, the type is assumed to be `OCCURRENCE`.

The <Link to="https://github.com/getsentry/sentry/blob/2e5a39ff3dd4afbd33f2ff7d2ba161285107afe4/src/sentry/issues/producer.py#L23">PayloadType</Link> enum has two types:
17hogeju marked this conversation as resolved.
Show resolved Hide resolved
- `OCCURRENCE`: for sending an occurrence
- `STATUS_CHANGE`: for sending a status update

Issue platform supports two types of payloads:
- `OCCURRENCE`
- `STATUS_CHANGE`
### Staus Change Message
If `payload_type` is set to `STATUS_CHANGE` in `produce_occurrence_to_kafka`, `status_change` will update the status of an issue.

### Staus Change
The `status_change` message format is as follows:
The `StatusChangeMessage` schema is as follows:
- `fingerprint`: unique identifier for the occurrence
- `new_status`: status string; one of {`resolved` | `archived` | `unresolved`}
- `new_substatus` [optional]:
- One of {`forever`, `until_escalating`, `until_condition_met`} for `archived`
- One of {`escalating` `ongoing`} for `unresolved`
- `project_id`: int.
- `new_status`: int. Uses <Link url="https://github.com/getsentry/sentry/blob/2e5a39ff3dd4afbd33f2ff7d2ba161285107afe4/src/sentry/models/group.py#L148">GroupStatus</Link> enum. We currently support the following:
- `UNRESOLVED`
- `RESOLVED`
- `IGNORED`
- `new_substatus`: int | None. Uses <Link url="https://github.com/getsentry/sentry/blob/2e5a39ff3dd4afbd33f2ff7d2ba161285107afe4/src/sentry/types/group.py#L4">GroupSubStatus</Link> enum. We do not support the `NEW` substatus.

## Releasing your issue type
The issue platform provides functionality to help release your new issue type in a controlled way. There are 3 feature flags that are used to release an issue type:
Expand Down
Loading