Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7ed64c1
fix: displaying "encoding error" when serializing empty strings (#1940)
JulienChavee Oct 20, 2025
41b15c9
fix(logs): `sentry.origin` value (#1938)
stayallive Oct 20, 2025
945f863
Prepare 4.17.0 (#1941)
Litarnus Oct 20, 2025
6292736
release: 4.17.0
getsentry-bot Oct 20, 2025
05f9008
Merge branch 'release/4.17.0'
Oct 20, 2025
c81a4db
Remove changelog entry for unreleased feature (#1943)
stayallive Oct 21, 2025
775c7ac
ref: change doc to use `never` instead of `none` (#1944)
Litarnus Oct 23, 2025
4885d13
fix: Only call curl_close() in PHP < 8 (#1947)
jamieburchell Oct 23, 2025
ebbfb6a
Prepare 4.17.1 (#1948)
Litarnus Oct 23, 2025
5c696b8
release: 4.17.1
getsentry-bot Oct 23, 2025
d4979b7
Merge branch 'release/4.17.1'
Oct 23, 2025
6df603d
Add support for Symfony 8 (#1895)
cleptric Oct 28, 2025
8e24c11
feat: feature flags (#1951)
stayallive Nov 4, 2025
6cad7b2
feat: try to represent any logs attribute as string (#1950)
stayallive Nov 4, 2025
01de10b
ref(logs): extract attribute compilation to dedicated method in LogsH…
huangdijia Nov 5, 2025
0e9d309
Prepare 4.18.0 (#1958)
Litarnus Nov 5, 2025
75f7efb
release: 4.18.0
getsentry-bot Nov 5, 2025
13d3536
Merge branch 'release/4.18.0'
Nov 5, 2025
60486ee
meta: Run CI on PHP 8.5 (#1927)
cleptric Nov 6, 2025
7797f85
chore: Update X handle (#1961)
cleptric Nov 7, 2025
8973b70
ref: add `addFeatureFlag` helper function (#1960)
Litarnus Nov 10, 2025
afb6cb5
Prepare 4.18.1 (#1965)
Litarnus Nov 11, 2025
04dcf20
release: 4.18.1
getsentry-bot Nov 11, 2025
10bf447
Merge branch 'release/4.18.1'
Nov 11, 2025
cdbfb21
ref(rate-limit): handle profile and check_in rate limiting (#1970)
Litarnus Nov 24, 2025
856d462
chore(deps): bump actions/checkout from 5 to 6 (#1971)
dependabot[bot] Nov 27, 2025
ccd7081
chore(deps): bump actions/create-github-app-token from 2.1.4 to 2.2.0…
dependabot[bot] Nov 27, 2025
c6f5826
docs: Update list of integrations regarding Neos (& TYPO3) (#1975)
kdambekalns Nov 27, 2025
dc31502
feat(metrics): introduce metrics (#1968)
Litarnus Nov 27, 2025
43cc60d
fix: spotlight not emitting logs or registering error handlers (#1964)
stayallive Nov 27, 2025
0068471
Prepare 4.19.0 (#1976)
Litarnus Nov 27, 2025
1d29a07
release: 4.19.0
getsentry-bot Nov 27, 2025
a105dea
Merge branch 'release/4.19.0'
Nov 27, 2025
f5d2790
fix(metrics): don't cast all values to float, reject invalid types (#…
Litarnus Dec 2, 2025
68c2faa
Prepare 4.19.1 (#1982)
Litarnus Dec 2, 2025
1c21d60
release: 4.19.1
getsentry-bot Dec 2, 2025
082d705
Merge branch 'release/4.19.1'
Dec 2, 2025
1fbcf15
ref(tests): move `ClockMock` into `tests` (#1983)
Litarnus Dec 3, 2025
a3ff546
ref(spotlight): normalize spotlight URL to not end with `/stream` (#1…
Litarnus Dec 4, 2025
b4ccc3a
chore(deps): bump actions/cache from 4 to 5 (#1987)
dependabot[bot] Dec 16, 2025
7431223
Merge branch 'master' into master-merge
Litarnus Dec 16, 2025
c921f00
resolve merge conflicts
Litarnus Dec 16, 2025
cf00e99
CS
Litarnus Dec 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ jobs:
- { version: '8.2', phpunit: '^9.6.21' }
- { version: '8.3', phpunit: '^9.6.21' }
- { version: '8.4', phpunit: '^9.6.21' }
- { version: '8.5', phpunit: '^9.6.25' }
dependencies:
- lowest
- highest

steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
fetch-depth: 2

Expand All @@ -60,7 +61,7 @@ jobs:
shell: bash

- name: Cache Composer dependencies
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ runner.os }}-${{ matrix.php.version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
steps:
- name: Get auth token
id: token
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
with:
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}

- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
token: ${{ steps.token.outputs.token }}
fetch-depth: 0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -52,7 +52,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
3 changes: 3 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return (new PhpCsFixer\Config())
->setRules([
'@PHP71Migration' => true,
Expand Down Expand Up @@ -35,6 +37,7 @@
'elements' => ['arrays'],
],
'no_whitespace_before_comma_in_array' => false, // Should be dropped when we drop support for PHP 7.x
'stringable_for_to_string' => false,
])
->setRiskyAllowed(true)
->setFinder(
Expand Down
84 changes: 84 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,89 @@
# CHANGELOG

## 4.19.1

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v4.19.1.

### Bug Fixes

- Don't cast metrics value to `float` in constructor, drop invalid metrics instead. [(#1981)](https://github.com/getsentry/sentry-php/pull/1981)

## 4.19.0

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v4.19.0.

### Features

- Add support for metrics. [(#1968)](https://github.com/getsentry/sentry-php/pull/1968)
```php
// Counter metric
\Sentry\trace_metrics()->count('test-counter', 10, ['my-attribute' => 'foo']);

// Gauge metric
\Sentry\trace_metrics()->gauge('test-gauge', 50.0, ['my-attribute' => 'foo'], \Sentry\Unit::millisecond());

// Distribution metric
\Sentry\trace_metrics()->distribution('test-distribution', 20.0, ['my-attribute' => 'foo'], \Sentry\Unit::kilobyte());

// Flush metrics
\Sentry\trace_metrics()->flush();
```

### Bug Fixes

- Add rate limiting for profiles and cron check-ins. [(#1970)](https://github.com/getsentry/sentry-php/pull/1970)
- Fix Spotlight so it always registers the error integrations and emits transport logs even when no DSN is configured. [(#1964)](https://github.com/getsentry/sentry-php/pull/1964)

## 4.18.1

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v4.18.1.

### Misc

- Add `addFeatureFlag` helper function. [(#1960)](https://github.com/getsentry/sentry-php/pull/1960)
```php
\Sentry\addFeatureFlag("my.feature.enabled", true);
```

## 4.18.0

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

### Features

- Add support for feature flags. [(#1951)](https://github.com/getsentry/sentry-php/pull/1951)
```php
\Sentry\SentrySdk::getCurrentHub()->configureScope(function (\Sentry\State\Scope $scope) {
$scope->addFeatureFlag("my.feature.enabled", true);
});
```
- Add more representations for log attributes instead of dropping them. [(#1950)](https://github.com/getsentry/sentry-php/pull/1950)

### Misc

- Merge log attributes in a separate method. [(#1931)](https://github.com/getsentry/sentry-php/pull/1931)

## 4.17.1

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v4.17.1.

### Misc

- Call `curl_close` only on PHP version 7.4 and below to prevent deprecation warnings. [(#1947)](https://github.com/getsentry/sentry-php/pull/1947)

## 4.17.0

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

### Bug Fixes

- Empty strings will no longer display `<encoding error>` when serialized. [(#1940)](https://github.com/getsentry/sentry-php/pull/1940)

### Misc

- Remove `symfony/phpunit-bridge` as a dev dependency. [(#1930)](https://github.com/getsentry/sentry-php/pull/1930)
- Update `sentry.origin` to be consistent with other SDKs. [(#1938)](https://github.com/getsentry/sentry-php/pull/1938)

## 4.16.0

The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v4.16.0.
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ The following integrations are available and maintained by members of the Sentry
- [WordPress](https://wordpress.org/plugins/wp-sentry-integration/)
- Magento 2 by [JustBetter](https://github.com/justbetter/magento2-sentry) or by [Mygento](https://github.com/mygento/module-sentry)
- [Joomla!](https://github.com/AlterBrains/sentry-joomla)
- Neos Flow (and CMS) using [flownative/sentry](https://github.com/flownative/flow-sentry) or [networkteam/sentryclient](https://github.com/networkteam/Networkteam.SentryClient)
- Neos CMS with specific Fusion handling using [networkteam/neos-sentryclient](https://github.com/networkteam/Netwokteam.Neos.SentryClient)
- [TYPO3](https://github.com/networkteam/sentry_client)
- ... feel free to be famous, create a port to your favourite platform!

## 3rd party integrations using the old SDK 3.x

- [Neos Flow](https://github.com/flownative/flow-sentry)
- [ZendFramework](https://github.com/facile-it/sentry-module)
- [Yii2](https://github.com/notamedia/yii2-sentry)
- [Silverstripe](https://github.com/phptek/silverstripe-sentry)
Expand All @@ -77,14 +79,11 @@ The following integrations are available and maintained by members of the Sentry

## 3rd party integrations using the old SDK 2.x

- [Neos Flow](https://github.com/networkteam/Networkteam.SentryClient)
- [OXID eShop](https://github.com/OXIDprojects/sentry)
- [TYPO3](https://github.com/networkteam/sentry_client)
- [CakePHP](https://github.com/Connehito/cake-sentry/tree/3.x)

## 3rd party integrations using the old SDK 1.x

- [Neos CMS](https://github.com/networkteam/Netwokteam.Neos.SentryClient)
- [OpenCart](https://github.com/BurdaPraha/oc_sentry)
- [TYPO3](https://github.com/networkteam/sentry_client/tree/2.1.1)

Expand Down Expand Up @@ -113,7 +112,7 @@ If you need help setting up or configuring the PHP SDK (or anything else in the
- [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/quickstart/)
- [![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/Ww9hbqr)
- [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-sentry-green.svg)](http://stackoverflow.com/questions/tagged/sentry)
- [![Twitter Follow](https://img.shields.io/twitter/follow/getsentry?label=getsentry&style=social)](https://twitter.com/intent/follow?screen_name=getsentry)
- [![X Follow](https://img.shields.io/twitter/follow/sentry?label=sentry&style=social)](https://x.com/intent/follow?screen_name=sentry)

## License

Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parameters:
excludePaths:
- tests/resources
- tests/Fixtures
- src/Util/ClockMock.php
- tests/TestUtil/ClockMock.php
dynamicConstantNames:
- Monolog\Logger::API
bootstrapFiles:
Expand Down
2 changes: 1 addition & 1 deletion psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ignoreFiles>
<directory name="vendor" />
<file name="src/Util/DebugType.php" />
<file name="src/Util/ClockMock.php" />
<file name="tests/TestUtil/ClockMock.php" />
</ignoreFiles>
</projectFiles>

Expand Down
25 changes: 18 additions & 7 deletions src/Attributes/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Sentry\Attributes;

use Sentry\Serializer\SerializableInterface;
use Sentry\Util\JSON;

/**
* @phpstan-type AttributeType 'string'|'boolean'|'integer'|'double'
* @phpstan-type AttributeValue string|bool|int|float
Expand Down Expand Up @@ -68,7 +71,7 @@ public static function fromValue($value): self
public static function tryFromValue($value): ?self
{
if ($value === null) {
return null;
return new self('null', 'string');
}

if (\is_bool($value)) {
Expand All @@ -83,14 +86,22 @@ public static function tryFromValue($value): ?self
return new self($value, 'double');
}

if (\is_string($value) || (\is_object($value) && method_exists($value, '__toString'))) {
$stringValue = (string) $value;

if (empty($stringValue)) {
return null;
if ($value instanceof SerializableInterface) {
try {
return new self(JSON::encode($value->toSentry()), 'string');
} catch (\Throwable $e) {
// Ignore the exception and continue trying other methods
}
}

if (\is_string($value) || (\is_object($value) && method_exists($value, '__toString'))) {
return new self((string) $value, 'string');
}

return new self($stringValue, 'string');
try {
return new self(JSON::encode($value), 'string');
} catch (\Throwable $e) {
// Ignore the exception
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Client implements ClientInterface
/**
* The version of the SDK.
*/
public const SDK_VERSION = '4.16.0';
public const SDK_VERSION = '4.19.1';

/**
* Regex pattern to detect if a string is a regex pattern (starts and ends with / optionally followed by flags).
Expand Down
29 changes: 29 additions & 0 deletions src/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Sentry\Context\OsContext;
use Sentry\Context\RuntimeContext;
use Sentry\Logs\Log;
use Sentry\Metrics\Types\Metric;
use Sentry\Profiling\Profile;
use Sentry\Tracing\Span;
use Sentry\Util\DebugType;
Expand Down Expand Up @@ -73,6 +74,11 @@ final class Event
*/
private $logs = [];

/**
* @var Metric[]
*/
private $metrics = [];

/**
* @var string|null The name of the server (e.g. the host name)
*/
Expand Down Expand Up @@ -248,6 +254,11 @@ public static function createLogs(?EventId $eventId = null): self
return new self($eventId, EventType::logs());
}

public static function createMetrics(?EventId $eventId = null): self
{
return new self($eventId, EventType::metrics());
}

/**
* Gets the ID of this event.
*/
Expand Down Expand Up @@ -444,6 +455,24 @@ public function setLogs(array $logs): self
return $this;
}

/**
* @return Metric[]
*/
public function getMetrics(): array
{
return $this->metrics;
}

/**
* @param Metric[] $metrics
*/
public function setMetrics(array $metrics): self
{
$this->metrics = $metrics;

return $this;
}

/**
* Gets the name of the server.
*/
Expand Down
17 changes: 17 additions & 0 deletions src/EventType.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public static function logs(): self
return self::getInstance('log');
}

public static function metrics(): self
{
return self::getInstance('trace_metric');
}

/**
* List of all cases on the enum.
*
Expand All @@ -59,9 +64,21 @@ public static function cases(): array
self::transaction(),
self::checkIn(),
self::logs(),
self::metrics(),
];
}

public function requiresEventId(): bool
{
switch ($this) {
case self::metrics():
case self::logs():
return false;
default:
return true;
}
}

public function __toString(): string
{
return $this->value;
Expand Down
8 changes: 6 additions & 2 deletions src/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ public function sendRequest(Request $request, Options $options): Response
if ($body === false) {
$errorCode = curl_errno($curlHandle);
$error = curl_error($curlHandle);
curl_close($curlHandle);
if (\PHP_MAJOR_VERSION < 8) {
curl_close($curlHandle);
}

$message = 'cURL Error (' . $errorCode . ') ' . $error;

Expand All @@ -115,7 +117,9 @@ public function sendRequest(Request $request, Options $options): Response

$statusCode = curl_getinfo($curlHandle, \CURLINFO_HTTP_CODE);

curl_close($curlHandle);
if (\PHP_MAJOR_VERSION < 8) {
curl_close($curlHandle);
}

$error = $statusCode >= 400 ? $body : '';

Expand Down
Loading