@apminsight/next 1.0.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 +102 -0
- package/index.js +6 -0
- package/lib/context.js +11 -0
- package/lib/render.js +19 -0
- package/license.txt +135 -0
- package/package.json +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# APM Insight Next.js instrumentation
|
|
2
|
+
|
|
3
|
+
This is the official Next.js framework instrumentation for the APM Insight Node.js agent.
|
|
4
|
+
|
|
5
|
+
The [Site24x7 Node.js agent][1] uses the APM Insight Next.js package to monitor the application key metrics and Next.js-specific metrics in the back-end. If you want to monitor the front-end metrics such as web vitals, AJAX calls, and pageviews, you need to inject the [RUM script][2] into the header or footer of the index page or a common page of your application. These metrics can help improve your application's performance and identify bottlenecks in the application.
|
|
6
|
+
|
|
7
|
+
**Note:**
|
|
8
|
+
* The minimum supported Next.js version is 12.0.9.
|
|
9
|
+
* The APM Insight Next.js package does not provide any instrumentation for actions that occur during the build or in client-side code.
|
|
10
|
+
|
|
11
|
+
Before you can use Next.js module, you need to install the [Site24x7 Node.js agent.][3]
|
|
12
|
+
|
|
13
|
+
## Table of contents:
|
|
14
|
+
* Installation
|
|
15
|
+
* Configuration
|
|
16
|
+
* Set configuration values
|
|
17
|
+
* Performance Metrics
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
This package is not bundled with the agent and must be installed separately. However, the package depends on the agent, so you will get all the agent's capabilities while loading this package.
|
|
21
|
+
* Run the following command in your Next.js project to install the APM Insight Node.js (APM) agent and APM Insight middleware for Next.js.
|
|
22
|
+
```
|
|
23
|
+
npm install apminsight @apminsight/next
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
* When the command is completed successfully, the dependencies will be listed in your package.json file.
|
|
27
|
+
```
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@apminsight/next": "^1.0.0",
|
|
30
|
+
"apminsight": "^3.1.2",
|
|
31
|
+
"next": "latest",
|
|
32
|
+
},
|
|
33
|
+
```
|
|
34
|
+
## Configuration
|
|
35
|
+
**Method 1:**
|
|
36
|
+
Next, modify your dev and start npm scripts by updating the scripts section of the package.json file. Allow your application to run with the Node’s -r option, which will preload @apminsight/next middleware.
|
|
37
|
+
```
|
|
38
|
+
NODE_OPTIONS='-r @apminsight/next' next start
|
|
39
|
+
```
|
|
40
|
+
The scripts section should look like the following:
|
|
41
|
+
```
|
|
42
|
+
"scripts": {
|
|
43
|
+
"dev": "NODE_OPTIONS='-r @apminsight/next' next",
|
|
44
|
+
"build": "next build",
|
|
45
|
+
"start": "NODE_OPTIONS='-r @apminsight/next' next start"
|
|
46
|
+
},
|
|
47
|
+
```
|
|
48
|
+
**Method 2:**
|
|
49
|
+
If you have no control over how your program is executed, you can load the @apminsight/next module before any other module. However, we recommend you avoid using this method at all costs. We discovered that bundling when running the next build causes issues and makes your bundle unnecessarily large.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
require('@apminsight/next')
|
|
53
|
+
/* ... the rest of your program ... */
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Method 3:**
|
|
57
|
+
For Custom Next.js servers:
|
|
58
|
+
If you're using Next as a custom server, you're probably not running your application using the Next CLI. In that case, we recommend executing the Next.js instrumentation as shown below.
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
node -r @apminsight/next your-start-file.js
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Set configuration values
|
|
65
|
+
If you want to configure in the file, follow the steps below:
|
|
66
|
+
* Create a new file named apminsightnode.json and place it in the directory where you run the application.
|
|
67
|
+
* Add the below code snippet in the file.
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
{"licenseKey" : "<license-key>",
|
|
71
|
+
"appName" : "<application-name>",
|
|
72
|
+
"port" : <application-port> }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
If you are using proxy:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
{"licenseKey" : "<license-key>",
|
|
79
|
+
"appName" : "<application-name>",
|
|
80
|
+
"port" : <application-port>,
|
|
81
|
+
"proxyServerHost" : "<proxy-server>",
|
|
82
|
+
"proxyServerPort" : <proxy-port>,
|
|
83
|
+
"proxyAuthUser" : "<proxy-user-name>",
|
|
84
|
+
"proxyAuthPassword" : "<proxy-password>"}
|
|
85
|
+
```
|
|
86
|
+
**Note:** You can also configure the values as [environment variables][4].
|
|
87
|
+
|
|
88
|
+
## Performance metrics
|
|
89
|
+
To view the metrics in the client:
|
|
90
|
+
* Log in to your [Site24x7][5] web client
|
|
91
|
+
* Navigate to APM > your Node.js application.
|
|
92
|
+
* Select the time frame for which you need the metrics. For which you can see your application’s server-side data flowing into the application monitor.
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
[1]: https://www.site24x7.com/help/apm/nodejs-agent.html
|
|
98
|
+
[2]: https://www.site24x7.com/help/apm/rum/add-rum-monitor.html
|
|
99
|
+
[3]: https://www.site24x7.com/help/apm/nodejs-agent/Install-Node.js-Agent.html
|
|
100
|
+
[4]: https://www.site24x7.com/help/apm/nodejs-agent/Install-Node.js-Agent.html#environment-variables
|
|
101
|
+
[5]: https://www.site24x7.com/
|
|
102
|
+
|
package/index.js
ADDED
package/lib/context.js
ADDED
package/lib/render.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var moduleInfo = {
|
|
2
|
+
functions: [
|
|
3
|
+
{
|
|
4
|
+
functionName: "renderToHTML",
|
|
5
|
+
component: "NEXTJS", //No I18N
|
|
6
|
+
extractInfo: getPath,
|
|
7
|
+
completeTrackerName : "Nextjs/Pre-render-HTML",
|
|
8
|
+
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function getPath(invoker, params, returnObj, tracker){
|
|
14
|
+
var info = {};
|
|
15
|
+
info.reqPath = params[2];
|
|
16
|
+
tracker.updateInfo(info);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = moduleInfo;
|
package/license.txt
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
PLEASE READ THE FOLLOWING LICENSE AGREEMENT CAREFULLY. BY DOWNLOADING THIS
|
|
2
|
+
SOFTWARE YOU AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE AGREEMENT.
|
|
3
|
+
|
|
4
|
+
This License Agreement details the policy for license of Site24x7 APM Insight
|
|
5
|
+
Next.js package ("Licensed Software") on the following topics:
|
|
6
|
+
|
|
7
|
+
* Free License
|
|
8
|
+
* Technical Support
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
1. FREE LICENSE:
|
|
12
|
+
ZOHO grants you a non-exclusive, non-transferable, worldwide license to use the
|
|
13
|
+
Licensed Software for no cost in perpetuity. You are forbidden from using the
|
|
14
|
+
Licensed Software for any other use or otherwise offering it for resale under
|
|
15
|
+
the terms of this Section 1. ZOHO retains all rights not specifically granted
|
|
16
|
+
to you herein.
|
|
17
|
+
|
|
18
|
+
2. THIRD PARTY PRODUCTS:
|
|
19
|
+
The Licensed Software may contain software which originated with third party
|
|
20
|
+
vendors and without limiting the general applicability of the other provisions
|
|
21
|
+
of this Agreement, you agree that (a) the title to any third party software
|
|
22
|
+
incorporated in the Licensed Software shall remain with the third party which
|
|
23
|
+
supplied the same; and (b) you will not distribute any such third party
|
|
24
|
+
software available with the Licensed Software, unless the license terms of such
|
|
25
|
+
third party software provide otherwise.
|
|
26
|
+
|
|
27
|
+
3. RESTRICTIONS ON USE:
|
|
28
|
+
In addition to all other terms and conditions of this Agreement, you shall not:
|
|
29
|
+
|
|
30
|
+
i. remove any copyright, trademark or other proprietary notices from the
|
|
31
|
+
Licensed Software or its copies;
|
|
32
|
+
ii. make any copies except for one back-up or archival copy, for temporary
|
|
33
|
+
emergency purpose;
|
|
34
|
+
iii. rent, lease, license, sublicense or distribute the Licensed Software or
|
|
35
|
+
any portions of it on a standalone basis or as part of your application;
|
|
36
|
+
iv. modify or enhance the Licensed Software;
|
|
37
|
+
v. reverse engineer, decompile or disassemble the Licensed Software;
|
|
38
|
+
vi. allow any third parties to access, use or support the Licensed Software.
|
|
39
|
+
|
|
40
|
+
4. TECHNICAL SUPPORT:
|
|
41
|
+
You may submit technical support queries through our discussion forums. Though
|
|
42
|
+
ZOHO will respond to such queries within a reasonable time in most cases, you
|
|
43
|
+
are not entitled to claim technical support as a matter of right.
|
|
44
|
+
|
|
45
|
+
5. OWNERSHIP AND INTELLECTUAL PROPERTY:
|
|
46
|
+
ZOHO owns all right, title and interest in and to the Licensed Software. ZOHO
|
|
47
|
+
expressly reserves all rights not granted to you herein, notwithstanding the
|
|
48
|
+
right to discontinue or not to release any Software and to alter prices,
|
|
49
|
+
features, specifications, capabilities, functions, licensing terms, release
|
|
50
|
+
dates, general availability or characteristics of the Licensed Software. The
|
|
51
|
+
Software is only licensed and not sold to you by ZOHO.
|
|
52
|
+
|
|
53
|
+
6. AUDIT:
|
|
54
|
+
ZOHO has the right to audit your Use of the Licensed Software by providing at
|
|
55
|
+
least seven (7) days prior written notice of its intention to conduct such an
|
|
56
|
+
audit at your facilities during normal business hours.
|
|
57
|
+
|
|
58
|
+
7. CONFIDENTIALITY:
|
|
59
|
+
The Licensed Software contains proprietary information of ZOHO that are
|
|
60
|
+
protected by the laws of the United States and you hereby agree to take all
|
|
61
|
+
reasonable efforts to maintain the confidentiality of the Licensed Software.
|
|
62
|
+
You agree to reasonably communicate the terms and conditions of this Agreement
|
|
63
|
+
to those persons employed by you who come into contact with or access the
|
|
64
|
+
Licensed Software, and to use reasonable efforts to ensure their compliance
|
|
65
|
+
with such terms and conditions, including but not limited to, not knowingly
|
|
66
|
+
permitting such persons to use any portion of the Licensed Software for a
|
|
67
|
+
purpose that is not allowed under this Agreement.
|
|
68
|
+
|
|
69
|
+
8. WARRANTY DISCLAIMER:
|
|
70
|
+
ZOHO does not warrant that the Licensed Software will be error-free. Except as
|
|
71
|
+
provided herein, the Licensed Software is furnished "as is" without warranty of
|
|
72
|
+
any kind, including the warranties of merchantability and fitness for a
|
|
73
|
+
particular purpose and without warranty as to the performance or results you
|
|
74
|
+
may obtain by using the Licensed Software. You are solely responsible for
|
|
75
|
+
determining the appropriateness of using the Licensed Software and assume all
|
|
76
|
+
risks associated with the use of it, including but not limited to the risks of
|
|
77
|
+
program errors, damage to or loss of data, programs or equipment, and
|
|
78
|
+
unavailability or interruption of operations.
|
|
79
|
+
Because some jurisdictions do not allow for the exclusion or limitation of
|
|
80
|
+
implied warranties, the above exclusions or limitations may not apply to you.
|
|
81
|
+
|
|
82
|
+
9. LIMITATION OF LIABILITY:
|
|
83
|
+
In no event will ZOHO be liable to you or any third party for any special,
|
|
84
|
+
incidental, indirect, punitive or exemplary or consequential damages, or
|
|
85
|
+
damages for loss of business, loss of profits, business interruption, or loss
|
|
86
|
+
of business information arising out of the use or inability to use the program
|
|
87
|
+
or for any claim by any other party even if ZOHO has been advised of the
|
|
88
|
+
possibility of such damages. ZOHO's entire liability with respect to its
|
|
89
|
+
obligations under this agreement or otherwise with respect to the Licensed
|
|
90
|
+
Software shall not exceed the amount of the named developer license fee paid by
|
|
91
|
+
you for the Licensed Software.
|
|
92
|
+
Because some jurisdictions do not allow the exclusion or limitation of
|
|
93
|
+
liability for incidental or consequential damages, the above exclusions or
|
|
94
|
+
limitations may not apply to you.
|
|
95
|
+
|
|
96
|
+
10. INDEMNIFICATION:
|
|
97
|
+
ZOHO agrees to indemnify and defend you from and against any and all claims,
|
|
98
|
+
actions or proceedings, arising out of any claim that the Licensed Software
|
|
99
|
+
infringes or violates any valid U.S. patent, copyright or trade secret right of
|
|
100
|
+
any third party; so long as you provide; (i) prompt written notice to ZOHO of
|
|
101
|
+
such claim; (ii) cooperate with ZOHO in the defense and/or settlement thereof,
|
|
102
|
+
at ZOHO's expense; and, (iii) allow ZOHO to control the defense and all related
|
|
103
|
+
settlement negotiations. The above is ZOHO's sole obligation to you and shall
|
|
104
|
+
be your sole and exclusive remedy pursuant to this Agreement for intellectual
|
|
105
|
+
property infringement.
|
|
106
|
+
ZOHO shall have no indemnity obligation for claims of infringement to the
|
|
107
|
+
extent resulting or alleged to result from (i) any combination, operation, or
|
|
108
|
+
use of the Licensed Software with any programs or equipment not supplied by
|
|
109
|
+
ZOHO; (ii) any modification of the Licensed Software by a party other than
|
|
110
|
+
ZOHO; and (iii) your failure, within a reasonable time frame, to implement any
|
|
111
|
+
replacement or modification of Licensed Software provided by ZOHO.
|
|
112
|
+
|
|
113
|
+
11. TERMINATION:
|
|
114
|
+
This Agreement is effective until terminated by either party. You may terminate
|
|
115
|
+
this Agreement at any time by destroying or returning to ZOHO all copies of the
|
|
116
|
+
Licensed Software in your possession. ZOHO may terminate this Agreement for any
|
|
117
|
+
reason, including but not limited to your breach of any of the terms of this
|
|
118
|
+
Agreement. Upon termination, you shall destroy or return to ZOHO all copies of
|
|
119
|
+
the Licensed Software and certify in writing that all know copies have been
|
|
120
|
+
destroyed. All provisions relating to confidentiality, proprietary rights,
|
|
121
|
+
non-disclosure, and limitation of liability shall survive the termination of
|
|
122
|
+
this Agreement.
|
|
123
|
+
|
|
124
|
+
12. GENERAL:
|
|
125
|
+
This Agreement shall be construed, interpreted and governed by the laws of the
|
|
126
|
+
State of California exclusive of its conflicts of law provisions. This
|
|
127
|
+
Agreement constitutes the entire agreement between the parties, and supersedes
|
|
128
|
+
all prior communications, understandings or agreements between the parties. Any
|
|
129
|
+
waiver or modification of this Agreement shall only be effective if it is in
|
|
130
|
+
writing and signed by both parties hereto. If any part of this Agreement is
|
|
131
|
+
found invalid or unenforceable, the remainder shall be interpreted so as to
|
|
132
|
+
reasonable effect the intention of the parties. You shall not export the
|
|
133
|
+
Licensed Software or your application containing the Licensed Software except
|
|
134
|
+
in compliance with United States export regulations and applicable laws and
|
|
135
|
+
regulations.
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@apminsight/next",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": {
|
|
11
|
+
"name" : "Zoho Corporation Pvt. Ltd.",
|
|
12
|
+
"email" : "apm-insight@zohocorp.com"
|
|
13
|
+
},
|
|
14
|
+
"license": "SEE LICENSE IN license.txt",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"apminsight": "^3.1.1",
|
|
17
|
+
"dotenv": "^16.3.1"
|
|
18
|
+
}
|
|
19
|
+
}
|