sentry-php

The official PHP SDK for Sentry (sentry.io)

MIT License

Downloads
146M
Stars
1.8K
Committers
233

Bot releases are visible (Hide)

sentry-php - 3.18.0

Published by getsentry-bot over 1 year ago

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v3.18.0.

Features

  • Add TransactionContext::fromEnvironment (#1519)

Misc

  • Sent all events to the /envelope endpoint if tracing is enabled (#1518)
  • Attach the Dynamic Sampling Context to error events (#1522)
sentry-php - 3.17.0

Published by getsentry-bot over 1 year ago

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v3.17.0.

Features

  • Add ignore_exceptions & ignore_transactions options (#1503)

    We deprecated the IgnoreErrorsIntegration in favor of this new option.
    The option will also take previous exceptions into account.

    \Sentry\init([
      'ignore_exceptions' => [BadThingsHappenedException::class],
    ]);
    

    To ignore a transaction being sent to Sentry, add its name to the config option.
    You can find the transaction name on the Performance page.

    \Sentry\init([
        'ignore_transactions' => ['GET /health'],
    ]);
    

Misc

  • Bump php-http/discovery to ^1.15 (#1504)

    You may need to allow the added composer plugin, introduced in php-http/discovery v1.15.0, to execute when running composer update.
    We previously pinned this package to version <1.15.
    Due to conflicts with other packages, we decided to lift this restriction.

sentry-php - 3.16.0

Published by getsentry-bot over 1 year ago

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v3.16.0.
This release adds initial support for Cron Monitoring.

Warning
Cron Monitoring is currently in beta. Beta features are still in-progress and may have bugs. We recognize the irony.
If you have any questions or feedback, please email us at [email protected], reach out via Discord (#cronjobs), or open an issue.

Features

  • Add inital support for Cron Monitoring (#1467)

    You can use Cron Monitoring to monitor your cron jobs. No pun intended.

    Add the code below to your application or script that is invoked by your cron job.
    The first Check-In will let Sentry know that your job started, with the second Check-In reporting the outcome.

    <?php
    
    $checkIn = new CheckIn(
        monitorSlug: '<your-monitor-slug>',
        status: CheckInStatus::inProgress(),
    );
    
    $event = Event::createCheckIn();
    $event->setCheckIn($checkIn);
    
    $this->hub->captureEvent($event);
    
    try {
    
        // do stuff
    
        $checkIn->setStatus(CheckInStatus::ok());
    } catch (Throwable $e) {
        $checkIn->setStatus(CheckInStatus::error());
    }
    
    $event = Event::createCheckIn();
    $event->setCheckIn($checkIn);
    
    $this->hub->captureEvent($event);
    

    If you only want to check if a cron did run, you may create a "Heartbeat" instead.
    Add the code below to your application or script that is invoked by your cron job.

    <?php
    
    // do stuff
    
    $checkIn = new CheckIn(
        monitorSlug: '<your-monitor-slug>',
        status: CheckInStatus::ok(), // or - CheckInStatus::error()
        duration: 10, // optional - duration in seconds
    );
    
    $event = Event::createCheckIn();
    $event->setCheckIn($checkIn);
    
    $this->hub->captureEvent($event);
    
  • Introduce a new trace helper function (#1490)

    We made it a tad easier to add custom tracing spans to your application.

    $spanContext = new SpanContext();
    $spanContext->setOp('function');
    $spanContext->setDescription('Soemthing to be traced');
    
    trace(
        function (Scope $scope) {
            // something to be traced
        },
        $spanContext,
    );
    
sentry-php - 3.15.0

Published by getsentry-bot over 1 year ago

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v3.15.0.
This release adds initial support for Profiling.

Warning
Profiling is currently in beta. Beta features are still in-progress and may have bugs. We recognize the irony.
If you have any questions or feedback, please email us at [email protected], reach out via Discord (#profiling), or open an issue.

Profiling is only available on Sentry SaaS (sentry.io). Support for Sentry self-hosted is planned once Profiling is released into GA.

Features

  • Add initial support for profiling (#1477)

    Under the hood, we're using Wikipedia's sampling profiler Excimer.
    We chose this profiler for its low overhead and for being used in production by one of the largest PHP-powered websites in the world.

    Excimer works with PHP 7.2 and up, for PHP 8.2 support, make sure to use Excimer version 1.1.0.

    There is currently no support for either Windows or macOS.

    You can install Excimer via your operating systems package manager.

    apt-get install php-excimer
    

    If no suitable version is available, you may build Excimer from source.

    git clone https://github.com/wikimedia/mediawiki-php-excimer.git
    
    cd excimer/
    phpize && ./configure && make && sudo make install
    

    Depending on your environment, you may need to enable the Excimer extension afterward.

    phpenmod -s fpm excimer
    # or
    phpenmod -s apache2 excimer
    

    Once the extension is installed, you may enable profiling by adding the new profiles_sample_rate config option to your Sentry::init method.

    \Sentry\init([
        'dsn' => '__DSN__',
        'traces_sample_rate' => 1.0,
        'profiles_sample_rate' => 1.0,
    ]);
    

    Profiles are being sampled in relation to your traces_sample_rate.

    Please note that the profiler is started inside transactions only. If you're not using our Laravel or Symfony SDKs, you may need to manually add transactions to your application as described here.

    Other things you should consider:

    • The current sample rate of the profiler is set to 101Hz (every ~10ms). A minimum of two samples is required for a profile being sent, hence requests that finish in less than ~20ms won't hail any profiles.
    • The maximum duration of a profile is 30s, hence we do not recommend enabling the extension in an CLI environment.
    • By design, the profiler will take samples at the end of any userland functions. You may see long sample durations on tasks like HTTP client requests and DB queries.
      You can read more about Excimer's architecture here.
sentry-php - 3.14.0

Published by getsentry-bot over 1 year ago

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v3.14.0.

Features

  • Add a new enable_tracing: true/false option, an alternative for traces_sample_rate: 1.0/null (#1458)

Bug Fixes

  • Fix missing keys in the request body (#1470)
  • Add support for partial JSON encoding (#1481)
  • Prevent calling magic methods when retrieving the ID from an object (#1483)
  • Only serialize scalar object IDs (#1485)

Misc

  • The SDK is now licensed under MIT (#1471)
    • Read more about Sentry's licensing here.
  • Deprecate Client::__construct $serializer argument. It is currently un-used (#1482)
sentry-php - 3.13.1

Published by getsentry-bot over 1 year ago

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v3.13.1.

Bug Fixes

  • Sanatize HTTP client spans & breadcrumbs (#1453)
  • Pin php-http/discovery to < 1.15 to disable some unwanted side-effect introduced in this new minor version (#1464)
sentry-php - 3.13.0

Published by getsentry-bot over 1 year ago

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v3.13.0.

Features

  • Object IDs are now automatically serialized as part of a stack trace frame (#1443)

  • Add more functionality to the ExceptionMechanism::class (#1450)

    • Attach arbitrary data
      $hint = EventHint::fromArray([
          'exception' => $exception,
          'mechanism' => new ExceptionMechanism(
              ExceptionMechanism::TYPE_GENERIC,
              false,
              [
                  'key' => 'value',
                  //...
              ],
          ),
      ]);
      captureEvent(Event::createEvent(), $hint);
      
      Learn more about the interface of the ExceptionMechanism on https://develop.sentry.dev/sdk/event-payloads/exception/#exception-mechanism
    • Access or mutate ExceptionMechanism::data via ExceptionMechanism::getData() and ExceptionMechanism::setData()
    • If an exception contains a user-provided code, the value will be serialized into the event and displayed on the issues details page.
      throw new \Exception('Oh no!', 123);
      
sentry-php - 3.12.1

Published by getsentry-bot almost 2 years ago

  • fix: Allow null on getTracesSampleRate and setTracesSampleRate in Options class (#1441)
sentry-php - 3.12.0

Published by getsentry-bot almost 2 years ago

  • feat: Add before_send_transaction option (#1424)
  • fix: Set traces_sample_rate to null by default (#1428)
sentry-php - 3.11.0

Published by getsentry-bot almost 2 years ago

  • fix: Only include the transaction name to the DSC if it has good quality (#1410)
  • ref: Enable the ModulesIntegration by default (#1415)
  • ref: Expose the ExceptionMechanism through the event hint (#1416)
sentry-php - 3.10.0

Published by getsentry-bot almost 2 years ago

  • ref: Add correct never option for max_request_body_size (#1397)
    • Deprecate max_request_body_size.none in favour of max_request_body_size.never
  • fix: Sampling now correctly takes in account the parent sampling decision if available instead of always being false when tracing is disabled (#1407)
sentry-php - 3.9.1

Published by getsentry-bot about 2 years ago

  • fix: Suppress errors on is_callable (#1401)
sentry-php - 3.9.0

Published by getsentry-bot about 2 years ago

  • feat: Add tracePropagationTargets option (#1396)
  • feat: Expose a function to retrieve the URL of the CSP endpoint (#1378)
  • feat: Add support for Dynamic Sampling (#1360)
    • Add segment to UserDataBag
    • Add TransactionSource, to set information about the transaction name via TransactionContext::setSource() (#1382)
    • Deprecate TransactionContext::fromSentryTrace() in favor of TransactionContext::fromHeaders()
sentry-php - 3.8.1

Published by getsentry-bot about 2 years ago

  • fix: Use constant for the SDK version (#1374)
  • fix: Do not throw an TypeError on numeric HTTP headers (#1370)
sentry-php - 3.8.0

Published by getsentry-bot about 2 years ago

  • Add Sentry\Monolog\BreadcrumbHandler, a Monolog handler to allow registration of logs as breadcrumbs (#1199)
  • Do not setup any error handlers if the DSN is null (#1349)
  • Add setter for type on the ExceptionDataBag (#1347)
  • Drop symfony/polyfill-uuid in favour of a standalone implementation (#1346)
sentry-php - 3.7.0

Published by getsentry-bot over 2 years ago

  • Fix Scope::getTransaction() so that it returns also unsampled transactions (#1334)
  • Set the event extras by taking the data from the Monolog record's extra (#1330)
sentry-php - 3.6.1

Published by getsentry-bot over 2 years ago

  • Set the sentry-trace header when using the tracing middleware (#1331)
sentry-php - 3.6.0

Published by getsentry-bot over 2 years ago

  • Add support for monolog/monolog:^3.0 (#1321)
  • Add setTag and removeTag public methods to Event for easier manipulation of tags (#1324)
sentry-php - 3.5.0

Published by getsentry-bot over 2 years ago

  • Bump minimum version of guzzlehttp/psr7 package to avoid CVE-2022-24775 (#1305)
  • Fix stripping of memory addresses from stacktrace frames of anonymous classes in PHP >=7.4.2 (#1314)
  • Set the default send_attempts to 0 (this disables retries) and deprecate the option. If you require retries you can increase the send_attempts option to the desired value. (#1312)
  • Add http_connect_timeout and http_timeout client options (#1282)
sentry-php - 3.4.0

Published by getsentry-bot over 2 years ago

  • Update Guzzle tracing middleware to meet the expected standard (#1234)
  • Add toArray public method in PayloadSerializer to be able to re-use Event serialization
  • The withScope methods now return the callback's return value (#1263)
  • Set the event extras by taking the data from the Monolog record's context (#1244)
  • Make the StacktraceBuilder class part of the public API and add the Client::getStacktraceBuilder() method to build custom stacktraces (#1124)
  • Support handling the server rate-limits when sending events to Sentry (#1291)
  • Treat the project ID component of the DSN as a string rather than an integer (#1294)