Skip to content

Commit

Permalink
rum-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
NasarTarique committed Jun 27, 2024
0 parents commit 233f126
Show file tree
Hide file tree
Showing 499 changed files with 40,901 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
**/example/assets/
42 changes: 42 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
channel: stable

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
- platform: android
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
- platform: ios
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
- platform: linux
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
- platform: macos
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
- platform: windows
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## 0.0.1

The following Key Metrics of Flutter Applications are Added in the Alpha Release.

- Mobile App Performance
- cpu usage
- memory usage
- cold/warm start
- ANR ( android)
- Native slow/frozen frames
- Flutter Errors & Exceptions
- Events
- session start
- route changes
- user interaction
- Http network info
- Load Duration , method , resource/type , request/response size
- Rum Asset Bundle
- Asset Size, Load time
- Custom events, logs, measurement, error
- Offline Caching of Events
Empty file added LICENSE
Empty file.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# rum_sdk

* Flutter SDK for Real User Monitoring

## Getting Started

[Docs](./docs/Getting%20Started.md)
182 changes: 182 additions & 0 deletions docs/Configurations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
## Configurations

### Http Tracking
To enable tracking http requests you can override the global HttpOverrides (if you have any other overrides add them before adding RumHttpOverrides)

```dart
HttpOverrides.global = RumHttpOverrides(HttpOverrides.current);
```

### Mobile Vitals
Mobile Vitals such as cpu usage, memory usage & refresh rate are disabled by default.
The interval for how often the vitals are sent can also be
given (default is set to 60 seconds)

```dart
RumFlutter().runApp(
optionsConfiguration: RumConfig(
// ...
cpuUsageVitals: true,
memoryUsageVitals: true,
anrTracking: true,
refreshrate: true,
fetchVitalsInterval: const Duration(seconds: 60),
// ...
),
appRunner:
//...
)
```

### Batching Configuration

The RUM logs can be batched and sent to the server in a single request. The batch size and the interval for sending the batch can be configured.

```dart
RumFlutter().runApp(
optionsConfiguration: RumConfig(
// ...
batchConfig: BatchConfig(
payloadItemLimit: 30, // default is 30
sendTimeout: const Duration(milliseconds: 500 ), // default is 500 milliseconds
enabled: true, // default is true
),
// ...
),
appRunner:
//...
)
```


### RateLimiting Configuration

Limit the number of concurrent requests made to the RUM server

```dart
RumFlutter().runApp(
optionsConfiguration: RumConfig(
// ...
maxBufferLimit: 30, // default is 30
// ...
),
appRunner:
//...
)
```

### Enable CrashReporting

enable capturing of app crashes

```dart
RumFlutter().runApp(
optionsConfiguration: RumConfig(
// ...
enableCrashReporting: false
// ...
),
appRunner:
//...
)
```


RUM Navigator Observer can be added to the list of observers to get view info and also send `view_changed` events when the route changes

```dart
return MaterialApp(
//...
navigatorObservers: [RumNavigationObserver()],
//...
),
```

### RUM User Interactions Widget

Add the Rum User Interactions Widget at the root level to enable the tracking of user interactions (click,tap...)

```dart
RumFlutter().runApp(
optionsConfiguration: RumConfig(
//...
),
appRunner: () => runApp(
const RumUserInteractionWidget(child: MyApp())
),
);
```

### RUM Asset Bundle

Add the Rum Asset Bundle to track asset load info

```dart
//..
appRunner: () => runApp(
DefaultAssetBundle(bundle: RumAssetBundle(), child: const RumUserInteractionWidget(child: MyApp()))
),
//..
```

### Sending Custom Events



```dart
RumFlutter().pushEvent(String name, {Map<String, String>? attributes})
// example
RumFlutter().pushEvent("event_name")
RumFlutter().pushEvent("event_name", attributes:{
attr1:"value"
})
```


### Sending Custom Logs
```dart
RumFlutter().pushLog(String message, {String? level ,Map<String, dynamic>? context,Map<String, dynamic>? trace})
//example
RumFlutter().pushLog("log_message",level:"warn")
```

### Sending Custom Measurements
- values can only have numeric values
```dart
RumFlutter().pushMeasurement(Map<String, dynamic >? values, String type)
RumFlutter().pushMeasurement({attr1:13.1, attr2:12},"some_measurements")
```

### Sending Custom Errors
```dart
RumFlutter().pushError({required type, required value, StackTrace? stacktrace, String? context})
```

### Capturing Event Duration

To capture the duration of an event you can use the following methods

```dart
RumFlutter().markEventStart(String key,String name)
// code
RumFlutter().markEventEnd(String key,String name, {Map<String, String>? attributes})
```



### Adding User Meta
```dart
RumFlutter().setUserMeta({String? userId, String? userName, String? userEmail});
// example
RumFlutter().addUserMeta(userId:"123",userName:"user",userEmail:"jhondoes@something.com")
```
45 changes: 45 additions & 0 deletions docs/Features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Rum Features

## RUM Event metadata

- view info
- app info (name, version , env)
- device info (os, version)
- user info (id,name)
- dart version
- session info

## Perfomance

- cpu usage
- memory usage
- cold/warm start
- ANR

## Exceptions

- Flutter Errors & Exceptions

## Events

- session start
- route changes
- user interaction

## Resource Load info

- http network info

- load duration
- method
- content/type
- request/ response size

- Rum Asset Bundle
- asset size
- asset load time

## More

- push custom events, logs, measurement, error
- Offline Caching of Events Storage
48 changes: 48 additions & 0 deletions docs/Getting Started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# RUM Flutter - 0.0.1 Alpha

## Getting Started

- Installation
- Initialise RUM

### Onboarding


### Installation

Add the following dependencies to your `pubspec.yaml`

```yml
rum_sdk:
git:
url: <git_url>
path: packages/rum_sdk
ref: main
```
### Initialise RUM
Add the following snippet to initialize RUM Monitoring with the default configurations
```dart

HttpOverrides.global = RumHttpOverrides(HttpOverrides.current); // enable http tracking

RumFlutter().runApp(
optionsConfiguration: RumConfig(
appName: "<App_Name>",
appVersion: "1.0.0",
appEnv: "Test",
apiKey: "<API_KEY>",
),
appRunner: () => runApp(
RumUserInteractionWidget(child: MyApp())
),
);



```


See all [configuration](./Configurations.md) options for RUM Flutter
Loading

0 comments on commit 233f126

Please sign in to comment.