• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

Sentry(v20.12.1) K8S 云原生架构探索,1分钟上手 JavaScript 性能监控

其他 为少 1474次浏览 0个评论

Sentry(v20.12.1) K8S 云原生架构探索,1分钟上手 JavaScript 性能监控

系列

  1. Sentry-Go SDK 中文实践指南
  2. 一起来刷 Sentry For Go 官方文档之 Enriching Events
  3. Snuba:Sentry 新的搜索基础设施(基于 ClickHouse 之上)
  4. Sentry 10 K8S 云原生架构探索,Vue App 1 分钟快速接入
  5. Sentry(v20.12.1) K8S云原生架构探索,玩转前/后端监控与事件日志大数据分析,高性能高可用+可扩展可伸缩集群部署
  6. Sentry(v20.12.1) K8S 云原生架构探索,Sentry JavaScript SDK 三种安装加载方式
  7. Sentry(v20.12.1) K8S 云原生架构探索,SENTRY FOR JAVASCRIPT SDK 配置详解
  8. Sentry(v20.12.1) K8S 云原生架构探索, SENTRY FOR JAVASCRIPT 手动捕获事件基本用法
  9. Sentry(v20.12.1) K8S 云原生架构探索,SENTRY FOR JAVASCRIPT Source Maps 详解
  10. Sentry(v20.12.1) K8S 云原生架构探索,SENTRY FOR JAVASCRIPT 故障排除

通过性能监视,Sentry 可以跟踪您的软件性能,测量吞吐量和延迟等指标,并显示多个系统之间的错误影响。

安装

安装跟踪软件包:

ESM

# Using yarn
yarn add @sentry/tracing

# Using npm
npm install @sentry/tracing

CDN

<script
  <!--
    Note that `bundle.tracing.min.js` contains both `@sentry/browser` AND
    `@sentry/tracing`, and should therefore be used in place of
    `@sentry/browser`'s bundle rather than in addition to it.
  -->
  src="https://browser.sentry-cdn.com/5.29.2/bundle.tracing.min.js"
  integrity="sha384-4zxA5Bnxor/VkZae20EqPP3A/6vDlw1ZhqF7EvpmeTfWYFjPIDdaUSOk/q7G/bYw"
  crossorigin="anonymous"
></script>

配置

通过以下两种方式在您的应用中启用性能监控:

  1. 使用 SDK 配置中的 tracesSampleRate 选项将所有 transactions 的统一采样率设置为 01 之间的数字。(例如,要发送 20%transactions,请将 tracesSampleRate 设置为 0.2。)
  2. 通过为 tracesSampler 配置选项提供功能,基于 transaction 本身及其捕获的上下文动态控制采样率。

ESM

// If you're using one of our integration packages, like `@sentry/react` or
// `@sentry/angular`, substitute its name for `@sentry/browser` here
import * as Sentry from "@sentry/browser";

// If taking advantage of automatic instrumentation (highly recommended)
import { Integrations as TracingIntegrations } from "@sentry/tracing";
// Or, if only manually tracing
// import * as _ from "@sentry/tracing"
// Note: You MUST import the package in some way for tracing to work

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",

  // This enables automatic instrumentation (highly recommended), but is not
  // necessary for purely manual usage
  integrations: [new TracingIntegrations.BrowserTracing()],

  // To set a uniform sample rate
  tracesSampleRate: 0.2

  // Alternatively, to control sampling dynamically
  tracesSampler: samplingContext => { ... }
});

CDN

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",

  // This enables automatic instrumentation (highly recommended), but is not
  // necessary for purely manual usage
  integrations: [new Sentry.Integrations.BrowserTracing()],

  // To set a uniform sample rate
  tracesSampleRate: 0.2

  // Alternatively, to control sampling dynamically
  tracesSampler: samplingContext => { ... }
});

如果设置了这些选项之一,则将在您的应用程序中启用跟踪。虽然这些选项是互斥的,但是如果您同时设置了这两个选项,tracesSampler 将具有优先权。您可以在 Sampling Transactions 中了解有关它们如何工作的更多信息。

验证

首次启用跟踪时,通过将 tracesSampleRate 设置为 1.0 来验证其是否正常运行,因为这可以确保将每个事务发送到 Sentry。

一旦测试完成,我们建议在生产中降低这个值,方法是降低您的 tracesSampleRate 值,或者切换到使用 tracesSampler 来动态取样和过滤您的 transaction。

在没有采样的情况下,我们的自动检测将在任何用户加载任何页面或在应用程序中的任何位置导航时发送 transaction。那是很多 transactions!采样可以实现代表性数据,而无需占用系统或 Sentry transaction 配额。

中文文档陆续同步到:

  • https://getsentry.hacker-linner.com
我是为少。
微信:uuhells123。
公众号:黑客下午茶。
谢谢点赞支持!


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明Sentry(v20.12.1) K8S 云原生架构探索,1分钟上手 JavaScript 性能监控
喜欢 (0)

您必须 登录 才能发表评论!

加载中……