andreybrigunet/sentry-tracing 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

andreybrigunet/sentry-tracing

最新稳定版本:1.4.4

Composer 安装命令:

composer require andreybrigunet/sentry-tracing

包简介

README 文档

README

A wrapper library for implementing custom instrumentation of Sentry performance monitoring.

Installation

composer require andreybrigunet/sentry-tracing

Basic usage

<?php

require __DIR__ . '/vendor/autoload.php';

// create and start a transaction
$transaction = new SentryTracing\Transaction('transaction name', 'operation.name');

// record a span
$span = new SentryTracing\Span('operation.name');
// do some stuff...
$span->end();

// record another span
$span = new SentryTracing\Span('operation.name');
// do some more stuff...
$span->end();


// end the transaction and send to sentry
$transaction->end();

Using the SENTRY_TRACE constant

To easily enable or disable tracing, define the SENTRY_TRACE before creating any transactions or spans. If the constant is not defined, it will default to true. The advantage of using this constant is that if at any point, you wish to turn off tracing, you can toggle the constant instead of removing all references to transactions and spans within your code base.

// enable tracing
const SENTRY_TRACE = true;

Connecting services

For traces that begin in the backend, connect the front end pageload transaction using meta tags.

<html>
  <head>
    <meta name="sentry-trace" content="<?= $span->getTraceId() ?>" />
    <meta name="baggage" content="<?= $span->getBaggage() ?>" />
    <!-- ... -->
  </head>
</html>

The span referenced should be the one that generates the HTML.

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-25