Skip to content

Commit 33eb455

Browse files
authored
chore: format docs with prettier (#523)
1 parent 4056e86 commit 33eb455

13 files changed

+341
-377
lines changed

.prettierignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dist
44
coverage
55
src/events
66
package-lock.json
7-
docs/
8-
.vscode
7+
.vscode
8+
tests_output/

.prettierrc.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,13 @@
33
"tabWidth": 4,
44
"semi": true,
55
"singleQuote": true,
6-
"endOfLine": "lf"
6+
"endOfLine": "lf",
7+
"overrides": [
8+
{
9+
"files": "*.md",
10+
"options": {
11+
"proseWrap": "never"
12+
}
13+
}
14+
]
715
}

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
## Code of Conduct
22

3-
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
4-
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
5-
[email protected] with any additional questions or comments.
3+
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact [email protected] with any additional questions or comments.

CONTRIBUTING.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
# Contributing Guidelines
22

3-
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
4-
documentation, we greatly value feedback and contributions from our community.
3+
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional documentation, we greatly value feedback and contributions from our community.
54

6-
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
7-
information to effectively respond to your bug report or contribution.
5+
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.
86

97
## Reporting Bugs/Feature Requests
108

119
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
1210

13-
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
14-
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
11+
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
1512

1613
- A reproducible test case or series of steps
1714
- The version of our code being used
@@ -35,18 +32,15 @@ To send us a pull request, please:
3532
5. Send us a pull request, answering any default questions in the pull request interface.
3633
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
3734

38-
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
39-
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
35+
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and [creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
4036

4137
## Finding contributions to work on
4238

4339
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
4440

4541
## Code of Conduct
4642

47-
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
48-
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
49-
[email protected] with any additional questions or comments.
43+
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact [email protected] with any additional questions or comments.
5044

5145
## Security issue notifications
5246

README.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Amazon CloudWatch RUM Web Client
22

3-
This is the CloudWatch RUM web client source code repository. It hosts a
4-
JavaScript library which performs real user monitoring (RUM) telemetry on web
5-
applications. Data collected by the RUM web client includes page load timing,
6-
JavaScript errors and HTTP requests.
3+
This is the CloudWatch RUM web client source code repository. It hosts a JavaScript library which performs real user monitoring (RUM) telemetry on web applications. Data collected by the RUM web client includes page load timing, JavaScript errors and HTTP requests.
74

85
## Install as a JavaScript Module
96

@@ -32,17 +29,9 @@ Use the following community resources for getting help with the SDK. We use the
3229

3330
## Opening Issues
3431

35-
If you encounter a bug with the CloudWatch RUM web client, we want to hear about
36-
it. Before opening a new issue, [search the existing
37-
issues](https://github.com/aws-observability/aws-rum-web/issues?q=is%3Aissue) to
38-
see if others are also experiencing the issue. Include the version of the
39-
CloudWatch RUM web client, Node.js runtime, and other dependencies if
40-
applicable. In addition, include the repro case when appropriate.
32+
If you encounter a bug with the CloudWatch RUM web client, we want to hear about it. Before opening a new issue, [search the existing issues](https://github.com/aws-observability/aws-rum-web/issues?q=is%3Aissue) to see if others are also experiencing the issue. Include the version of the CloudWatch RUM web client, Node.js runtime, and other dependencies if applicable. In addition, include the repro case when appropriate.
4133

42-
The GitHub issues are intended for bug reports and feature requests. For help
43-
and questions about using the CloudWatch RUM web client, use the resources
44-
listed in the Getting Help section. Keeping the list of open issues lean helps
45-
us respond in a timely manner.
34+
The GitHub issues are intended for bug reports and feature requests. For help and questions about using the CloudWatch RUM web client, use the resources listed in the Getting Help section. Keeping the list of open issues lean helps us respond in a timely manner.
4635

4736
## Contributing
4837

@@ -112,18 +101,15 @@ npm run integ -- chrome:headless
112101
npm run integ -- chrome
113102
```
114103

115-
Some features perform monkey patching which is incompatible with TestCafe. In
116-
these cases, run Nightwatch as a separate browser integration test target:
104+
Some features perform monkey patching which is incompatible with TestCafe. In these cases, run Nightwatch as a separate browser integration test target:
117105

118106
```
119107
npm run integ:local:nightwatch
120108
```
121109

122110
## Pre-commit Tasks
123111

124-
The CloudWatch RUM web client uses pre-commit tasks to lint and format its
125-
source code. Before submitting code, check that all linter and formatter
126-
warnings have been resolved.
112+
The CloudWatch RUM web client uses pre-commit tasks to lint and format its source code. Before submitting code, check that all linter and formatter warnings have been resolved.
127113

128114
Attempt to automatically repair linter warnings:
129115

@@ -139,8 +125,7 @@ npm run prettier:fix
139125

140126
## Security
141127

142-
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more
143-
information.
128+
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
144129

145130
## License
146131

docs/cdn_angular.md

Lines changed: 65 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,107 @@
1-
# Using the CloudWatch RUM Web Client with Angular 12
1+
# Using the CloudWatch RUM Web Client with Angular 12
22

33
## Add the snippet to index.html
44

55
To install the web client in an Angular application, add the snippet inside the \<head\> tag of `index.html`.
66

77
```html
8-
<!doctype html>
8+
<!DOCTYPE html>
99
<html lang="en">
10-
<head>
11-
<script>
12-
(function(n,i,v,r,s,c,u,x,z){x=window.AwsRumClient={q:[],n:n,i:i,v:v,r:r,c:c,u:u};window[n]=function(c,p){x.q.push({c:c,p:p});};z=document.createElement('script');z.async=true;z.src=s;document.head.insertBefore(z,document.getElementsByTagName('script')[0]);})('cwr','00000000-0000-0000-0000-000000000000','1.0.0','us-west-2','https://client.rum.us-east-1.amazonaws.com/1.0.2/cwr.js',{sessionSampleRate:1,identityPoolId:'us-west-2:00000000-0000-0000-0000-000000000000',endpoint:'https://dataplane.rum.us-west-2.amazonaws.com',telemetries:['errors','http','performance'],allowCookies:true});
13-
</script>
14-
...
15-
</head>
16-
<body>
17-
...
18-
</body>
10+
<head>
11+
<script>
12+
(function (n, i, v, r, s, c, u, x, z) {
13+
x = window.AwsRumClient = {
14+
q: [],
15+
n: n,
16+
i: i,
17+
v: v,
18+
r: r,
19+
c: c,
20+
u: u
21+
};
22+
window[n] = function (c, p) {
23+
x.q.push({ c: c, p: p });
24+
};
25+
z = document.createElement('script');
26+
z.async = true;
27+
z.src = s;
28+
document.head.insertBefore(
29+
z,
30+
document.getElementsByTagName('script')[0]
31+
);
32+
})(
33+
'cwr',
34+
'00000000-0000-0000-0000-000000000000',
35+
'1.0.0',
36+
'us-west-2',
37+
'https://client.rum.us-east-1.amazonaws.com/1.0.2/cwr.js',
38+
{
39+
sessionSampleRate: 1,
40+
identityPoolId:
41+
'us-west-2:00000000-0000-0000-0000-000000000000',
42+
endpoint: 'https://dataplane.rum.us-west-2.amazonaws.com',
43+
telemetries: ['errors', 'http', 'performance'],
44+
allowCookies: true
45+
}
46+
);
47+
</script>
48+
...
49+
</head>
50+
<body>
51+
...
52+
</body>
53+
</html>
1954
```
2055

2156
## Instrument Routing to Record Page Views
2257

23-
If your application contains arguments in the URL's path, you likely want to
24-
record custom page IDs so that the arguments can be removed and the pages will
25-
be properly aggregated in CloudWatch. For example, if we have two URLs
26-
`https://amazonaws.com/user/123` and `https://amazonaws.com/user/456`, we likely
27-
want to remove the user ID from the path so that the page ID is `/user` for both
28-
URLs.
58+
If your application contains arguments in the URL's path, you likely want to record custom page IDs so that the arguments can be removed and the pages will be properly aggregated in CloudWatch. For example, if we have two URLs `https://amazonaws.com/user/123` and `https://amazonaws.com/user/456`, we likely want to remove the user ID from the path so that the page ID is `/user` for both URLs.
2959

30-
For Angular applications, we can subscribe to the `NavigationEnd` event, and
31-
record a custom page ID using the URL provided by the router:
60+
For Angular applications, we can subscribe to the `NavigationEnd` event, and record a custom page ID using the URL provided by the router:
3261

3362
```typescript
3463
import { Router, NavigationEnd } from '@angular/router';
3564

3665
declare function cwr(operation: string, payload: any): void;
3766

3867
export class MyComponent implements OnInit {
39-
40-
constructor(private router: Router) {}
41-
42-
ngOnInit(): void {
43-
this.router.events.subscribe(event => {
44-
if (event instanceof NavigationEnd) {
45-
console.log('this.router.url');
46-
cwr('recordPageView', this.router.url);
47-
}
48-
});
49-
}
50-
68+
constructor(private router: Router) {}
69+
70+
ngOnInit(): void {
71+
this.router.events.subscribe((event) => {
72+
if (event instanceof NavigationEnd) {
73+
console.log('this.router.url');
74+
cwr('recordPageView', this.router.url);
75+
}
76+
});
77+
}
5178
}
5279
```
5380

54-
5581
## Instrument Error Handling to Record Errors
5682

57-
Angular intercepts uncaught JavaScript errors that originate within the
58-
Angular application. Because Angular intercepts these errors, they will not be
59-
recorded by the web client. This can be fixed by creating an error handler that
60-
records uncaught errors using the web client's `recordError` command:
83+
Angular intercepts uncaught JavaScript errors that originate within the Angular application. Because Angular intercepts these errors, they will not be recorded by the web client. This can be fixed by creating an error handler that records uncaught errors using the web client's `recordError` command:
6184

6285
### 1. Create an error handler
6386

6487
`src/app/cwr-error-handler.ts`
88+
6589
```typescript
66-
import { ErrorHandler } from "@angular/core";
90+
import { ErrorHandler } from '@angular/core';
6791

6892
declare function cwr(operation: string, payload: any): void;
6993

7094
export class RumErrorHandler implements ErrorHandler {
71-
handleError(error: any) {
72-
cwr('recordError', error);
73-
}
95+
handleError(error: any) {
96+
cwr('recordError', error);
97+
}
7498
}
7599
```
76100

77101
### 2. Install the error handler in the root module:
78102

79103
`src/app/app.module.ts`
104+
80105
```typescript
81106
import { RumErrorHandler } from './cwr-error-handler';
82107
@NgModule({

0 commit comments

Comments
 (0)