Skip to content

Commit

Permalink
Add plugin to detect broken links (getsentry#69)
Browse files Browse the repository at this point in the history
Fixes various issues and converts to absolute URLs (relative doesnt appear to work).
  • Loading branch information
dcramer authored Jun 29, 2020
1 parent c9b617c commit 42d41eb
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 87 deletions.
3 changes: 3 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ const getPlugins = () => {
noInlineHighlight: true,
},
},
{
resolve: `gatsby-remark-check-links`,
},
],
},
},
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"gatsby-plugin-sharp": "^2.6.2",
"gatsby-plugin-zeit-now": "^0.3.0",
"gatsby-remark-autolink-headers": "^2.3.1",
"gatsby-remark-check-links": "^2.1.0",
"gatsby-remark-copy-linked-files": "^2.3.2",
"gatsby-remark-images": "^3.3.1",
"gatsby-remark-prismjs": "^3.5.1",
Expand All @@ -44,6 +45,7 @@
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"prestart": "gatsby clean",
"start": "npm run develop",
"format": "prettier --write \"src/**/*.js\"",
"test": "GATSBY_ENV=test gatsby build"
Expand Down
18 changes: 14 additions & 4 deletions src/docs/continuous-integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@ The "Delete all repository caches" button does NOT work.
Type the following into your browser devtools console on the [Travis cache page](https://travis-ci.org/getsentry/sentry/caches):

```javascript
Travis.__registry__._resolveCache['config:environment'].skipConfirmations = true; btns=document.getElementsByClassName("delete-cache-icon"); i=0; while (i<btns.length) { btns[i].click(); i++; }
Travis.__registry__._resolveCache[
"config:environment"
].skipConfirmations = true;
btns = document.getElementsByClassName("delete-cache-icon");
i = 0;
while (i < btns.length) {
btns[i].click();
i++;
}
```

Or this works too and is prettier:

```javascript
window.confirm = (m => true); Array.from(document.getElementsByClassName('delete-cache-icon')).map(e => e.click());
window.confirm = (m) => true;
Array.from(document.getElementsByClassName("delete-cache-icon")).map((e) =>
e.click()
);
```

## GitHub Actions
Expand All @@ -35,7 +46,7 @@ fixes. We're also trialing it as a way to run acceptance tests.
## Percy

Percy checks the outputs of acceptance tests and reports on changes in rendered
results. See the [testing chapter for more information](/testing#percy)
results. See the [testing chapter for more information](/testing/#percy)

## Freight

Expand Down Expand Up @@ -77,4 +88,3 @@ When pushing your build to staging and you it fails the `Ensure test image` step
**Solution:**

You probably forgot to push your branch on Sentry to GitHub.

13 changes: 0 additions & 13 deletions src/docs/frontend/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@ title: Frontend Handbook

This guide covers how we write frontend code at Sentry, and is specifically focussed on the [Sentry](https://github.com/getsentry/sentry) and [Getsentry](https://github.com/getsentry/getsentry) codebases. It assumes you are using the eslint rules outlined by [eslint-config-sentry](https://github.com/getsentry/eslint-config-sentry); hence code style enforced by these linting rules will not be discussed here.

## Quick links:

- [Directory structure](#directory-structure)
- [React](#react)
- [CSS and Emotion](#css-and-emotion)
- [State management](#state-management)
- [Testing](#testing)
- [Babel Syntax Plugins](#babel-syntax-plugins)
- [New Syntax](#new-syntax)
- [lodash](#lodash)
- [Typescript](#typescript)
- [Contributing](#contributing)

## Directory structure

The frontend codebase is currently located under `src/sentry/static/sentry/app` in sentry and `static/getsentry` in getsentry. (We intend to align to `static/sentry` in future.)
Expand Down
2 changes: 1 addition & 1 deletion src/docs/sdk/event-payloads/properties/spans.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
`spans`

: _Recommended_. A list of [Spans](/sdk/event-payloads/span).
: _Recommended_. A list of [Spans](/sdk/event-payloads/span/).

```json
{
Expand Down
50 changes: 25 additions & 25 deletions src/docs/sdk/event-payloads/properties/status.mdx
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
`status`

: _Optional_. Describing the `status` of the Span. We use this property to determine if the [Transaction](./transaction)
: _Optional_. Describing the `status` of the Span. We use this property to determine if the [Transaction](/sdk/event-payloads/properties/transaction/)
ended in an error or not.

State|Description|HTTP status code equivalent
---|---|---
`ok`|Not an error, returned on success|200 and 2XX HTTP statuses
`cancelled`|The operation was cancelled, typically by the caller|499
`unknown` or `unknown_error` |An unknown error raised by APIs that don't return enough error information|500
`invalid_argument`|The client specified an invalid argument|400
`deadline_exceeded`|The deadline expired before the operation could succeed|504
`not_found`|Content was not found or request was denied for an entire class of users|404
`already_exists`|The entity attempted to be created already exists|409
`permission_denied`|The caller doesn't have permission to execute the specified operation|403
`resource_exhausted`|The resource has been exhausted e.g. per-user quota exhausted, file system out of space|429
`failed_precondition`|The client shouldn't retry until the system state has been explicitly handled|400
`aborted`|The operation was aborted|409
`out_of_range`|The operation was attempted past the valid range e.g. seeking past the end of a file|400
`unimplemented`|The operation is not implemented or is not supported/enabled for this operation|501
`internal_error`|Some invariants expected by the underlying system have been broken. This code is reserved for serious errors|500
`unavailable`|The service is currently available e.g. as a transient condition|503
`data_loss`|Unrecoverable data loss or corruption|500
`unauthenticated`|The requester doesn't have valid authentication credentials for the operation|401
| State | Description | HTTP status code equivalent |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------ | --------------------------- |
| `ok` | Not an error, returned on success | 200 and 2XX HTTP statuses |
| `cancelled` | The operation was cancelled, typically by the caller | 499 |
| `unknown` or `unknown_error` | An unknown error raised by APIs that don't return enough error information | 500 |
| `invalid_argument` | The client specified an invalid argument | 400 |
| `deadline_exceeded` | The deadline expired before the operation could succeed | 504 |
| `not_found` | Content was not found or request was denied for an entire class of users | 404 |
| `already_exists` | The entity attempted to be created already exists | 409 |
| `permission_denied` | The caller doesn't have permission to execute the specified operation | 403 |
| `resource_exhausted` | The resource has been exhausted e.g. per-user quota exhausted, file system out of space | 429 |
| `failed_precondition` | The client shouldn't retry until the system state has been explicitly handled | 400 |
| `aborted` | The operation was aborted | 409 |
| `out_of_range` | The operation was attempted past the valid range e.g. seeking past the end of a file | 400 |
| `unimplemented` | The operation is not implemented or is not supported/enabled for this operation | 501 |
| `internal_error` | Some invariants expected by the underlying system have been broken. This code is reserved for serious errors | 500 |
| `unavailable` | The service is currently available e.g. as a transient condition | 503 |
| `data_loss` | Unrecoverable data loss or corruption | 500 |
| `unauthenticated` | The requester doesn't have valid authentication credentials for the operation | 401 |

```json
{
"status": "ok"
}
```
```json
{
"status": "ok"
}
```
38 changes: 19 additions & 19 deletions src/docs/sdk/event-payloads/span.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Span Interface

The Span Interface specifies a series of _timed_ application events that have a start and end time.

A [Transaction](./transaction) may contain zero or more Spans in an attribute named `spans`.
A [Transaction](/sdk/event-payloads/transaction/) may contain zero or more Spans in an attribute named `spans`.

This interface is an object with a single `values` attribute containing an
ordered list of Span objects. Spans in the list don't have to be ordered, they will be ordered
Expand All @@ -15,46 +15,46 @@ useful when it includes at least an `op` and `description`.

## Attributes

import "./properties/span_id.mdx"
import "./properties/span_id.mdx";

import "./properties/parent_span_id.mdx"
import "./properties/parent_span_id.mdx";

import "./properties/trace_id.mdx"
import "./properties/trace_id.mdx";

import "./properties/transaction.mdx"
import "./properties/transaction.mdx";

import "./properties/sampled.mdx"
import "./properties/sampled.mdx";

import "./properties/op.mdx"
import "./properties/op.mdx";

import "./properties/description.mdx"
import "./properties/description.mdx";

import "./properties/span_start_timestamp.mdx"
import "./properties/span_start_timestamp.mdx";

import "./properties/span_timestamp.mdx"
import "./properties/span_timestamp.mdx";

import "./properties/status.mdx"
import "./properties/status.mdx";

import "./properties/tags.mdx"
import "./properties/tags.mdx";

`data`

: _Optional_. Arbitrary data associated with this Span.

```json
{
"data": {
"url":"http://localhost:8080/sockjs-node/info?t=1588601703755",
"status_code":200,
"type":"xhr",
"method":"GET"
}
"data": {
"url": "http://localhost:8080/sockjs-node/info?t=1588601703755",
"status_code": 200,
"type": "xhr",
"method": "GET"
}
}
```

## Examples

The following example illustrates the Span as part of the [Transaction](./transaction) and omits other attributes for simplicity.
The following example illustrates the Span as part of the [Transaction](/sdk/event-payloads/transaction/) and omits other attributes for simplicity.

```json
{
Expand Down
50 changes: 25 additions & 25 deletions src/docs/sdk/event-payloads/transaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,57 @@ Transactions are used to send tracing events to Sentry.
Transactions must be wrapped in an [Envelope](/sdk/envelopes/) and therefore also be sent to the Envelope endpoint.

<Alert title="Note on backwards compatibility" level="info">

Envelopes are a new format and therefore only work on Sentry >= 10. More information can be found on the [Envelope](/sdk/envelopes/) page.
Envelopes are a new format and therefore only work on Sentry >= 10. More
information can be found on the <Link to="/sdk/envelopes/">Envelope</Link> page.
</Alert>

## Anatomy

A Transaction is basically a [Span](/sdk/event-payloads/span) combined with an [Event](/sdk/event-payloads/). When using
A Transaction is basically a [Span](/sdk/event-payloads/span/) combined with an [Event](/sdk/event-payloads/). When using
tracing with our SDKs you usually create a Span tree, the root node and therefore the whole tree is considered to be the Transaction.
So technically a Transaction is just a Span. A Transaction must also have a `contexts.trace` (which contains some data of the [Span](/sdk/event-payloads/span)) and some other
So technically a Transaction is just a Span. A Transaction must also have a `contexts.trace` (which contains some data of the [Span](/sdk/event-payloads/span/)) and some other
properties that will be covered in the next section.

Transactions are [Events](/sdk/event-payloads/) enriched with [Span](/sdk/event-payloads/span) data.
Transactions are [Events](/sdk/event-payloads/) enriched with [Span](/sdk/event-payloads/span/) data.
We are only going to list here what is important for a Transaction.

import "./properties/type.mdx"
import "./properties/type.mdx";

import "./properties/span_start_timestamp.mdx"
import "./properties/span_start_timestamp.mdx";

import "./properties/span_timestamp.mdx"
import "./properties/span_timestamp.mdx";

### contexts.trace

A Transaction has to have a specific `contexts.trace` entry that contains data from the [Span](/sdk/event-payloads/span).
A Transaction has to have a specific `contexts.trace` entry that contains data from the [Span](/sdk/event-payloads/span/).

import "./properties/span_id.mdx"
import "./properties/span_id.mdx";

import "./properties/parent_span_id.mdx"
import "./properties/parent_span_id.mdx";

import "./properties/trace_id.mdx"
import "./properties/trace_id.mdx";

import "./properties/op.mdx"
import "./properties/op.mdx";

import "./properties/description.mdx"
import "./properties/description.mdx";

import "./properties/status.mdx"
import "./properties/status.mdx";

## Examples

```json
{
"contexts": {
"trace": {
"op": "navigation",
"description": "User clicked on <Link />",
"trace_id": "743ad8bbfdd84e99bc38b4729e2864de",
"span_id": "a0cfbde2bdff3adc",
"status": "ok",
"parent_span_id": "99659d76b7cdae94"
}
"contexts": {
"trace": {
"op": "navigation",
"description": "User clicked on <Link />",
"trace_id": "743ad8bbfdd84e99bc38b4729e2864de",
"span_id": "a0cfbde2bdff3adc",
"status": "ok",
"parent_span_id": "99659d76b7cdae94"
}
}
}
```

import "./properties/spans.mdx"
import "./properties/spans.mdx";
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7257,6 +7257,13 @@ gatsby-remark-autolink-headers@^2.3.1:
mdast-util-to-string "^1.1.0"
unist-util-visit "^1.4.1"

gatsby-remark-check-links@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/gatsby-remark-check-links/-/gatsby-remark-check-links-2.1.0.tgz#8e8a2b1b82ac6c516fcc2074e8f806e2c0d53571"
integrity sha512-TbhT8oVlAgJfxe0WUQWDOb0kLkMUYo1N4AfFstejClPWO4OjRlznt3IMW3weQkwuweiovF5cxVpQcFrkCGVFBw==
dependencies:
unist-util-visit "^1.4.1"

gatsby-remark-copy-linked-files@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/gatsby-remark-copy-linked-files/-/gatsby-remark-copy-linked-files-2.3.2.tgz#56cda0f16e2be111f61c97047e6a1b014e53f2aa"
Expand Down

0 comments on commit 42d41eb

Please sign in to comment.