@aaronbassett/netlify-plugin-development 中文文档教程
New Relic Netlify Plugin
监控您的 Netlify 构建过程和Jamstack 应用程序性能与 New Relic,无需冗长的手动设置。
New Relic Netlify 插件:
- Notifies New Relic on Netlify build events including: Pre Build, Post Build, Sucess, and Failure.
- Installs the browser agent across your static pages
- Adds a release version to each deployment for easier monitoring and debugging
Installation
有关详细安装说明,请参阅“使用 New Relic Netlify 插件和快速入门快速启动您的 Jamstack 监控”
UI Installation
UI 安装 是开始使用插件的最快方式,不需要对项目代码进行任何修改。
- Navigate to the Netlify plugin directory, search for New Relic, and select install and then choose which of your Netlify sites will use the plugin
- Go to your site settings > build and deploy > environment and set the following environment variables:
- NEWRELICACCOUNTID: Your New Relic Account ID
- NEWRELICINGESTLICENSE_KEY: A New Relic ingest license key
- NEWRELICBROWSERLICENSE_KEY: A New Relic browser ingest license key
- NEWRELICAPPID: Your New Relic Browser App ID
- ENABLEBROWSERMONITORING: Set this to true
File-based Installation
或者,要使用 基于文件的安装 进行安装,请将以下行添加到您的 netlify.toml
文件:
package = "@newrelic/netlify-plugin"
[plugins.inputs]
newrelicAccountId = "123456"
newrelicLicenseKey = "12345678901234567890"
newrelicBrowserLicenseKey = "ABCD-0987654321"
newrelicAppId = "123456789"
enableBrowserMonitoring = true
替换 newrelicAccountId
、newrelicLicenseKey
、newrelicBrowserLicenseKey
和 newrelicAppId< 的值/code> 与您的 New Relic 帐户 ID、您的摄取和浏览器摄取许可证密钥以及您的 New Relic 浏览器应用程序 ID。
Install the Netlify quickstart
为了充分利用 Netlify 集成,您还应该安装 New Relic Netlify quickstart。 您可以在 New Relic I/O 的快速入门页面上找到更多信息。
Settings
该插件允许通过环境变量或您的 netlify.toml
自定义以下设置。
netlify.toml key |
Environment variable name | Description | Required for | Default value |
---|---|---|---|---|
failBuildOnPluginError | FAILBUILDONPLUGINERROR | Fail the whole build if the plugin has an error | true | |
newrelicAccountId | NEWRELICACCOUNTID | New Relic Account ID | event tracking & browser monitoring | undefined |
newrelicLicenseKey | NEWRELICINGESTLICENSE_KEY | New Relic Ingest License Key | event tracking | undefined |
newrelicBrowserLicenseKey | NEWRELICBROWSERLICENSE_KEY | New Relic Ingest License Key | event tracking | undefined |
newrelicAppId | NEWRELICAPPID | New Relic APM App ID | browser monitoring | undefined |
recordEventsForPreviews | RECORDEVENTSFOR_PREVIEWS | Set this to true if you want to record events for deploy previews | false | |
skipEvent.onPreBuild | SKIPPREBUILD_EVENT | Set this to true to skip recording onPreBuild custom events | false | |
skipEvent.onBuild | SKIPBUILDEVENT | Set this to true to skip recording onBuild custom events | false | |
skipEvent.onPostBuild | SKIPPOSTBUILD_EVENT | Set this to true to skip recording onPostBuild custom events | false | |
skipEvent.onSuccess | SKIPSUCCESSEVENT | Set this to true to skip recording onSuccess custom events | false | |
skipEvent.onError | SKIPERROREVENT | Set this to true to skip recording onError custom events | false | |
skipEvent.onEnd | SKIPENDEVENT | Set this to true to skip recording onEnd custom events | false | |
enableBrowserMonitoring | ENABLEBROWSERMONITORING | Attempt to inject the browser monitor script tag into any HTML pages | false | |
enableBrowserMonitoringForPreviews | ENABLEBROWSERMONITORINGFORPREVIEWS | Set this to true if you want to enable browser monitoring for deploy previews | false | |
distributedTracingEnabled | DISTRIBUTEDTRACINGENABLED | Enable distributed tracing for browser requests | true | |
cookiesEnabled | COOKIES_ENABLED | Enable cookies for browser monitoring | true | |
htmlInjectionConcurrency | HTMLINJECTIONCONCURRENCY | Number of concurrently pending promises to use when injecting browser agent | 5 | |
revisionTemplate | REVISION_TEMPLATE | Deploy marker revision and release version id structure (EJS string) | <% if(git.commits[0].message){ % ><%= git.commits[0].message.slice(0,25) % >-<% } % ><%= process.env.CONTEXT % >-<%= process.env.COMMITREF.slice(0, 7) % >-<%= process.env.DEPLOYID.slice(-6) % >-<%= process.env.BUILD_ID.slice(-6) % > |
Support
该插件是 New Relic experimental 的一部分。 该项目正在公开开发中,我们欢迎所有反馈和贡献。
Contributing
我们鼓励您为改进 New Relic Netlify 插件做出贡献!
请记住,当您提交拉取请求时,您需要使用 CLA-Assistant 通过点击来签署 CLA。 每个项目只需签署一次 CLA。
如果您有任何疑问,或执行我们的企业 CLA(如果您代表公司做出贡献),请给我们发送电子邮件至 opensource@newrelic.com。
A note about vulnerabilities
正如我们的安全政策中所述,New Relic 致力于保护我们客户及其数据的隐私和安全。 我们相信,由安全研究人员提供协调一致的信息披露并与安全社区合作是实现我们安全目标的重要手段。
如果您认为您在该项目或任何 New Relic 的产品或网站中发现了安全漏洞,我们欢迎并非常感谢您通过 HackerOne 向 New Relic 报告该漏洞。
License
New Relic Netlify 插件根据 Apache 2.0 许可证获得许可。