@nuux/sentry 0.4.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Nuux::Sentry
|
|
2
2
|
|
|
3
|
-
Automatically configures Sentry for your Rails application
|
|
3
|
+
Automatically configures Sentry for your Rails application.
|
|
4
4
|
|
|
5
5
|
- https://docs.sentry.io/clients/ruby/
|
|
6
6
|
- https://docs.sentry.io/platforms/javascript/
|
|
@@ -35,12 +35,12 @@ Define `SENTRY_DSN` as environment variable.
|
|
|
35
35
|
Nuux::Sentry.configure do |config|
|
|
36
36
|
config.environments = %w[staging production]
|
|
37
37
|
|
|
38
|
-
config.user =
|
|
38
|
+
config.user = proc { try(:current_user) }
|
|
39
39
|
config.user_attributes = %i[id username]
|
|
40
40
|
config.browser_user_attributes = config.user_attributes
|
|
41
41
|
|
|
42
|
-
config.user_context =
|
|
43
|
-
config.extra_context =
|
|
42
|
+
config.user_context = proc { { ip_address: request.remote_ip } }
|
|
43
|
+
config.extra_context = {}
|
|
44
44
|
end
|
|
45
45
|
```
|
|
46
46
|
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
let config = {}
|
|
2
|
-
let user = {}
|
|
3
|
-
let tags = {}
|
|
4
2
|
|
|
5
3
|
const element = document.head.querySelector("meta[name='sentry']")
|
|
6
4
|
|
|
7
5
|
if (element) {
|
|
8
6
|
config = JSON.parse(window.atob(element.getAttribute("content")))
|
|
9
|
-
|
|
10
|
-
if (config.user) {
|
|
11
|
-
user = config.user
|
|
12
|
-
delete config.user
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (config.tags) {
|
|
16
|
-
tags = config.tags
|
|
17
|
-
delete config.tags
|
|
18
|
-
}
|
|
19
7
|
}
|
|
20
8
|
|
|
21
|
-
export { config
|
|
9
|
+
export { config }
|
|
@@ -1,37 +1,12 @@
|
|
|
1
1
|
import * as Sentry from "@sentry/browser"
|
|
2
|
-
import { Integrations as TracingIntegrations } from "@sentry/tracing"
|
|
3
2
|
|
|
4
|
-
import { config
|
|
3
|
+
import { config } from "./config"
|
|
5
4
|
import { isObject, debug } from "./helper"
|
|
6
5
|
|
|
7
|
-
export const init = (
|
|
6
|
+
export const init = () => {
|
|
8
7
|
if (isObject(config) && config.dsn) {
|
|
9
|
-
// Integrations
|
|
10
|
-
if (!Array.isArray(config.integrations)) config.integrations = []
|
|
11
|
-
|
|
12
|
-
// Enable tracing
|
|
13
|
-
config.integrations.push(new TracingIntegrations.BrowserTracing())
|
|
14
|
-
if (!config.tracesSampleRate) config.tracesSampleRate = 1.0
|
|
15
|
-
|
|
16
|
-
// Apply custom configuration
|
|
17
|
-
if (tapFunc instanceof Function) tapFunc(config, user, tags)
|
|
18
|
-
|
|
19
8
|
debug("@nuux/sentry: init", config)
|
|
20
9
|
Sentry.init(config)
|
|
21
|
-
|
|
22
|
-
Sentry.configureScope((scope) => {
|
|
23
|
-
if (isObject(user)) {
|
|
24
|
-
debug("@nuux/sentry: setUser", user)
|
|
25
|
-
scope.setUser(user)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (isObject(tags)) {
|
|
29
|
-
debug("@nuux/sentry: setTags", tags)
|
|
30
|
-
for (let [key, value] of Object.entries(tags)) {
|
|
31
|
-
scope.setTag(key, value);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
10
|
}
|
|
36
11
|
}
|
|
37
12
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuux/sentry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Initialize Sentry from a meta tag",
|
|
5
5
|
"main": "app/assets/javascript/nuux-sentry/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
"author": "nuux",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@sentry/browser": "^
|
|
13
|
-
"@sentry/cli": "^
|
|
14
|
-
"@sentry/tracing": "^6.8.0"
|
|
12
|
+
"@sentry/browser": "^7.47.0",
|
|
13
|
+
"@sentry/cli": "^2.17.0"
|
|
15
14
|
},
|
|
16
15
|
"files": [
|
|
17
16
|
"app/assets/javascript/nuux-sentry/*.js"
|