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
<script>functioninitTrakerr() { var c =newTrakerrClient('<api-key>', '<version of your code>', '<deployment stage of codebase>'); c.handleExceptions(false); } initTrakerr();</script>
17
+
<script>functioninitTrakerr() { var c =newTrakerrClient('<api-key>', '1.0', 'production'); c.handleExceptions(false); } initTrakerr();</script>
18
18
```
19
19
20
-
This will catch all errors using javascript's onerror and send them to trakerr. While this code is useful, we recommend using the Detailed Integration Guide below to send more useful information about errors.
20
+
You can replace `1.0` and `production` with the values of app version and deployment stage of your codebase.
21
+
22
+
This will catch all errors using javascript's onerror and send them to trakerr. While this code is fast and clean, we recommend using the Detailed Integration Guide below to send more useful information about errors.
$log.error(exception, cause);//Relogs the error on the console
68
77
});
69
78
};
70
79
}]);
@@ -73,14 +82,14 @@ angular.module('your app').factory('$exceptionHandler', ['$window', function ($w
73
82
## Detailed Integration Guide
74
83
This library works with both node apps and browser apps seamlessly.
75
84
76
-
For node apps just installing the above dependencies and bootstrapping the code similar to the below is sufficient. See the instructions below for the browser.
77
-
78
85
### Create a client
79
86
In your script, the first thing before sending an event is to create a client. For npm apps, you may use require, but other options are also listed below.
80
87
81
88
```javascript
82
89
var TrakerrClient =require('trakerr-javascript'); //This is only necessary for NPM use.
83
-
var client =newTrakerrClient('<api-key>', '<app version here>', '<deployment stage here>'); // replace value within quotes with your values instead
90
+
var client =newTrakerrClient('<api-key>', //Your API key
91
+
'<app version here>', //Your app version
92
+
'<deployment stage here>'); //Custom deployment stage of your code.
84
93
```
85
94
86
95
### Option-1: Handle exceptions with a global handler
@@ -106,7 +115,7 @@ This will allow you to catch and send a specific error to trakerr, also allowing
106
115
```
107
116
108
117
### Option-3: Send error to Trakerr programmatically and populate some custom properties on the event
109
-
Passing a function to sendError will allow you to quickly populate the properties of the created AppEvent. For AppEvent's properties, see it's docs in the generated folder. The function must take in a parameter.
118
+
Passing a function to sendError will allow you to quickly populate the properties of the created AppEvent. For [AppEvent's properties](generated/docs/AppEvent.md), see it's docs in the generated folder. The function must take in a parameter.
110
119
111
120
```javascript
112
121
try {
@@ -116,6 +125,13 @@ Passing a function to sendError will allow you to quickly populate the propertie
116
125
client.sendError(err, "Error", function(event) {
117
126
118
127
// set some custom properties on the event
128
+
event.contextOperationTimeMillis=1000
129
+
event.eventUser="jake@trakerr.io"
130
+
event.eventSession="20"
131
+
event.contextDevice="pc"
132
+
event.contextAppSku="mobile"
133
+
event.contextTags= ["client", "frontend"]
134
+
119
135
event.customProperties= {
120
136
customString: {
121
137
customData1:"Some data"
@@ -162,6 +178,8 @@ var exports = function TrakerrClient(apiKey,
162
178
163
179
The TrakerrClient module has a lot of exposed properties. The benefit to setting these immediately after after you create the TrakerrClient is that AppEvent will default it's values against the TrakerClient that created it. This way if there is a value that all your AppEvents uses, and the constructor default value currently doesn't suit you; it may be easier to change it in TrakerrClient as it will become the default value for all AppEvents created after. A lot of these are populated by default value by the constructor, but you can populate them with whatever string data you want. The following table provides an in depth look at each of those.
164
180
181
+
If you're populating an app event directly, you'll want to take a look at the [AppEvent properties](generated/docs/AppEvent.md) as they contain properties unique to each AppEvent which do not have defaults you may set in the client.
**apiKey** | **string** | API key generated for the application |
@@ -175,12 +193,14 @@ Name | Type | Description | Notes
175
193
**contextAppOSVersion** | **string** | OS Version the application is running on. | Default value: OS Version.
176
194
**contextAppOSBrowser** | **string** | An optional string browser name the application is running on. | Defaults to the browser name if the app is running from a browser.
177
195
**contextAppOSBrowserVersion** | **string** | An optional string browser version the application is running on. | Defaults to the browser version if the app is running from a browser.
178
-
**contextDataCenter** | **string** | Data center the application is running on or connected to. | Defaults to `nil`
179
-
**contextDataCenterRegion** | **string** | Data center region. | Defaults to `nil`
196
+
**contextDataCenter** | **string** | Data center the application is running on or connected to. | Defaults to `'undefined'`
197
+
**contextDataCenterRegion** | **string** | Data center region. | Defaults to `'undefined'`
198
+
**contextTags** | **Array.<String>** | Array of string tags you can use to tag your components for searching., | Defaults to `'undefined'`
199
+
**contextAppSKU** | **string** | Application SKU. | Defaults to `'undefined'`
you can then use grunt to compile your own minified version of the code. The grunt task we use can be executed with:
210
230
211
231
```bash
212
232
grunt build
213
233
```
214
-
in the folder with gruntFile.js. If you wish to modify or fork our code, simply running `grunt build` in the folder after acquire the code.
234
+
in the folder with gruntFile.js. If you wish to modify or fork our code, simply run `grunt build` after modifying the code to try it out in your browser locally.
**apiKey** | **String** | API key generated for the application |
7
7
**logLevel** | **String** | (optional) Logging level, one of 'debug','info','warning','error', 'fatal', defaults to 'error' | [optional]
8
-
**classification** | **String** | (optional) one of 'error' or a custom string for non-errors, defaults to 'error' |
8
+
**classification** | **String** | (optional) one of 'issue' or a custom string for non-issues, defaults to 'issue' |
9
9
**eventType** | **String** | type of the event or error (eg. NullPointerException) |
10
10
**eventMessage** | **String** | message containing details of the event or error |
11
11
**eventTime** | **Integer** | (optional) event time in ms since epoch | [optional]
@@ -24,6 +24,14 @@ Name | Type | Description | Notes
24
24
**contextAppOSVersion** | **String** | (optional) OS version the application is running on | [optional]
25
25
**contextDataCenter** | **String** | (optional) Data center the application is running on or connected to | [optional]
26
26
**contextDataCenterRegion** | **String** | (optional) Data center region | [optional]
27
+
**contextTags** | **[String]** | | [optional]
28
+
**contextURL** | **String** | (optional) The full URL when running in a browser when the event was generated. | [optional]
29
+
**contextOperationTimeMillis** | **Integer** | (optional) duration that this event took to occur in millis. Example - database call time in millis. | [optional]
30
+
**contextCpuPercentage** | **Integer** | (optional) CPU utilization as a percent when event occured | [optional]
31
+
**contextMemoryPercentage** | **Integer** | (optional) Memory utilization as a percent when event occured | [optional]
0 commit comments