You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/Getting Started.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
# Getting Started
2
2
3
-
This guide is an introduction to the ErrorTracker, an Elixirbased built-in error tracking solution. The ErrorTracker provides a basic and free error-tracking solution integrated in your own application. It is designed to be easy to install and easy to use so you can integrate it in your existing project with minimal changes. The only requirement is a relational database in which errors will be tracked.
3
+
This guide is an introduction to ErrorTracker, an Elixir-based built-in error tracking solution. ErrorTracker provides a basic and free error-tracking solution integrated in your own application. It is designed to be easy to install and easy to use so you can integrate it in your existing project with minimal changes. The only requirement is a relational database in which errors will be tracked.
4
4
5
-
In this guide we will learn how to install the ErrorTracker in an Elixir project so you can start reporting errors as soon as possible. We will also cover more advanced topics such as how to report custom errors and how to add extra context to reported errors.
5
+
In this guide we will learn how to install ErrorTracker in an Elixir project so you can start reporting errors as soon as possible. We will also cover more advanced topics such as how to report custom errors and how to add extra context to reported errors.
6
6
7
-
**This guide requires you to have setup Ecto with PostgreSQL beforehand.**
7
+
**This guide requires you to have set up Ecto with PostgreSQL beforehand.**
8
8
9
9
## Installing the ErrorTracking as a dependency
10
10
11
-
The first step add the ErrorTracker to your application is to declare the package as a dependency in your `mix.exs` file:
11
+
The first step to add ErrorTracker to your application is to declare the package as a dependency in your `mix.exs` file:
12
12
13
13
```elixir
14
14
# mix.exs
@@ -19,29 +19,29 @@ defp deps do
19
19
end
20
20
```
21
21
22
-
Once the ErrorTracker is declared as a dependency of your application, you can install it with the following command:
22
+
Once ErrorTracker is declared as a dependency of your application, you can install it with the following command:
23
23
24
24
```bash
25
25
mix deps.get
26
26
```
27
27
28
-
## Configuring the ErrorTracker
28
+
## Configuring ErrorTracker
29
29
30
-
The ErrorTracker needs a few configuration options to work. This configuration should be added in your `config/config.exs` file:
30
+
ErrorTracker needs a few configuration options to work. This configuration should be added to your `config/config.exs` file:
31
31
32
32
```elixir
33
33
config :error_tracker,
34
34
repo:MyApp.Repo,
35
35
otp_app::my_app
36
36
```
37
37
38
-
The `:repo` option specifies the repository that will be used by the ErrorTracker. You can use your regular application repository, or a different one if you prefer to keep errors in a different database.
38
+
The `:repo` option specifies the repository that will be used by ErrorTracker. You can use your regular application repository or a different one if you prefer to keep errors in a different database.
39
39
40
-
The `:otp_app` option specifies your application name. When an error happens the ErrorTracker will use this information to understand which parts of the stacktrace belong to your application and which parts belong to thirdparty dependencies. This allows you to filter in-app vs third-party frames when viewing errors.
40
+
The `:otp_app` option specifies your application name. When an error occurs, ErrorTracker will use this information to understand which parts of the stack trace belong to your application and which parts belong to third-party dependencies. This allows you to filter in-app vs third-party frames when viewing errors.
41
41
42
42
## Setting up the database
43
43
44
-
Since the ErrorTracker stores errors in the database you must create a database migration to add the required tables:
44
+
Since ErrorTracker stores errors in the database you must create a database migration to add the required tables:
45
45
46
46
```
47
47
mix ecto.gen.migration add_error_tracker
@@ -58,17 +58,17 @@ defmodule MyApp.Repo.Migrations.AddErrorTracker do
58
58
end
59
59
```
60
60
61
-
You can run the migration and perform the database changes with the following command:
61
+
You can run the migration and apply the database changes with the following command:
62
62
63
63
```bash
64
64
mix ecto.migrate
65
65
```
66
66
67
-
For more information about how to handle migrations take a look at the `ErrorTracker.Migration` module docs.
67
+
For more information about how to handle migrations, take a look at the `ErrorTracker.Migration` module docs.
68
68
69
69
## Automatic error tracking
70
70
71
-
At this point, the ErrorTracker is ready to track errors. It will automatically start when your application boots and track errors that happen in your Phoenix controllers, Phoenix LiveViews and Oban jobs. The `ErrorTracker.Integrations.Phoenix` and `ErrorTracker.Integrations.Oban` provide detailed information about how this works.
71
+
At this point, ErrorTracker is ready to track errors. It will automatically start when your application boots and track errors that occur in your Phoenix controllers, Phoenix LiveViews and Oban jobs. The `ErrorTracker.Integrations.Phoenix` and `ErrorTracker.Integrations.Oban` provide detailed information about how this works.
72
72
73
73
If your application uses Plug but not Phoenix, you will need to add the relevant integration in your `Plug.Builder` or `Plug.Router` module.
74
74
@@ -81,7 +81,7 @@ defmodule MyApp.Router do
81
81
end
82
82
```
83
83
84
-
This is also required if you want to track errors that happen in your Phoenix endpoint, before the Phoenix router starts handling the request. Keep in mind that this won't be needed in most cases as endpoint errors are very infrequent.
84
+
This is also required if you want to track errors that happen in your Phoenix endpoint, before the Phoenix router starts handling the request. Keep in mind that this won't be needed in most cases as endpoint errors are infrequent.
85
85
86
86
```elixir
87
87
defmoduleMyApp.Endpointdo
@@ -98,17 +98,17 @@ You can learn more about this in the `ErrorTracker.Integrations.Plug` module doc
98
98
99
99
The default integrations include some additional context when tracking errors. You can take a look at the relevant integration modules to see what is being tracked out of the box.
100
100
101
-
In certain cases you may want to include some additional information when tracking errors. For example it may be useful to track the user ID that was using the application when an error happened. Fortunately, the ErrorTracker allows you to enrich the default context with custom information.
101
+
In certain cases, you may want to include some additional information when tracking errors. For example it may be useful to track the user ID that was using the application when an error happened. Fortunately, ErrorTracker allows you to enrich the default context with custom information.
102
102
103
-
The `ErrorTracker.set_context/1` function stores the given context in the current process so any errors that happen in that process (for example a Phoenix request or an Oban job) will include this given context along with the default integration context.
103
+
The `ErrorTracker.set_context/1` function stores the given context in the current process so any errors that occur in that process (for example, a Phoenix request or an Oban job) will include this given context along with the default integration context.
If you want to report custom errors that fall outside the default integrations scope you may use `ErrorTracker.report/2`. This allows you to report an exception by yourself:
111
+
If you want to report custom errors that fall outside the default integration scope, you may use `ErrorTracker.report/2`. This allows you to report an exception yourself:
112
112
113
113
```elixir
114
114
trydo
@@ -123,6 +123,6 @@ You can also use `ErrorTracker.report/3` and set some custom context that will b
123
123
124
124
## Web UI
125
125
126
-
The ErrorTracker also provides a dashboard built with Phoenix LiveView that can be used to see and manage the recorded errors.
126
+
ErrorTracker also provides a dashboard built with Phoenix LiveView that can be used to see and manage the recorded errors.
127
127
128
-
This is completely optional and you can find more information about it in the `ErrorTracker.Web` module documentation.
128
+
This is completely optional, and you can find more information about it in the `ErrorTracker.Web` module documentation.
0 commit comments