Oh f*ck

error

@xf3l1x
f3l1x.io
26.11.2022
nonroot@myhomeserver /srv/hosting/myweb/var/log # tree
.
├── access.log
├── exception.log
├── exception--2020-01-10--11-53--dioth4sfqq.html
├── exception--2020-03-13--05-00--puu05ty49w.html
├── exception--2020-03-22--05-43--sax38djo7u.html
├── exception--2020-03-29--11-45--uinbbg49ek.html
├── exception--2020-06-10--08-12--j8gy3mrf27.html
├── exception--2020-12-13--05-01--3d2ffe5567.html
├── exception--2020-12-22--07-43--tbthm9fkq8.html
├── exception--2021-02-30--13-22--gm9f2pdi0o.html
├── exception--2021-05-13--05-00--wj7cz5ntl4.html
├── exception--2021-06-22--07-12--9rx28vi6tg.html
├── exception--2021-09-29--11-25--uhnag3qwj7.html
├── exception--2022-09-30--13-22--f932521753.html
├── exception--2022-10-04--10-06--9ef0aff0c9.html
├── exception--2022-10-04--14-45--kjrxfkatth.html
├── exception--2022-10-06--13-45--d0ttmrwk7d.html
├── exception--2022-10-06--21-15--773f46333b.html
├── exception--2022-10-11--08-37--a792ea033d.html
├── exception--2022-10-17--12-44--482474d173.html
├── exception--2022-10-24--11-58--0dcb67675c.html
└── exception--2022-11-07--14-30--55d43ea1c6.html

Sentry

try {
    $this->functionFailsForSure();
} catch (\Throwable $exception) {
    \Sentry\captureException($exception);
}
composer require sentry/sdk

Installation

\Sentry\init(['dsn' => 'https://KEY1@KEY2.ingest.sentry.io/KEY3']);

Contributte

Sentry

# config.neon

extensions:
    sentry: Contributte\Sentry\DI\SentryExtension
    
sentry:
    enable: %productionMode%
    client:
        dsn: "https://{KEY1}@{KEY2}.ingest.sentry.io/{KEY3}"
composer require contributte/sentry

Installation

Contributte / Sentry

// Sentry
EnvironmentIntegration
ErrorListenerIntegration
ExceptionListenerIntegration
FatalErrorListenerIntegration
FrameContextifierIntegration
ModulesIntegration
RequestIntegration
TransactionIntegration
// Nette
NetteApplicationIntegration
NetteHttpIntegration
NetteSecurityIntegration
NetteSessionIntegration
ExtraIntegration

// Upload
S3UploadIntegration

// Performance
NetteApplicationMonitor
NetteDatabaseMonitor
LatteMonitor
NetteContainerMonitor
# config.neon

extensions:
    sentry: Contributte\Sentry\DI\SentryExtension
    
sentry:
    enable: %productionMode%
    client:
        dsn: "https://{KEY1}@{KEY2}.ingest.sentry.io/{KEY3}"
        sample_rate: 0.5 # 0-1 * 100

Sentry [sample rate]

Sentry [enable/disable keys]

...or business plan

Sentry [relay]

docker run --rm -it
    -v $(pwd)/config/:/srv/relay/ \
    -p 3000:3000 \
    getsentry/relay \
    run --config /srv/relay/
# /srv/relay/config.yml
relay:
    mode: proxy
    host: 0.0.0.0
    port: 3000
metrics:
    sample_rate: 0.1 # 0-1 * 100

managed

static

proxy

capture

extensions:
    sentry: Contributte\Sentry\DI\SentryExtension
    
sentry:
    client:
        integrations:
            - Contributte\Sentry\Integration\S3UploadIntegration()

services:
    - Contributte\Sentry\Upload\S3Uploader(
        Contributte\Sentry\Upload\S3Signer(
          accessKeyId: secret
          secretKey: secret
          url: myorg.r2.cloudflarestorage.com / s3.eu-central-1.amazonaws.com
          bucket: mybucket
          region: auto
          prefix: null
        )
    )

Sentry [uploader]

mangoweb-backend

monolog-tracy-handler

Tracy

Tracy

X

Tracy

X

Ladenky / RSOD

🍳 Easy wheezy

🌤️ Cloud services

💆‍♀️ Self hosted

🚧 Creating / making

class Bootstrap
{
	public static function boot(): Configurator
	{
		$configurator = new Configurator;

		$configurator->setDebugMode(true / false);
		$configurator->enableTracy(__DIR__ . '/../log');

		TracyX::enable([
			'accessId' => 'secret',
			'accessToken' => 'secret',
		]);
	}
}

TracyX [config]

TracyX [architecture]

API​

APP

PAGES

STORAGE (R2)

DB (D1)

ERROR

Text

TRACY

TRACY-X

WORKER

WEB

store
save
upload
catch

AUTH

Zero Trust
presigned URL

TracyX [pricing]

Workers  → 100k reqs / day 🆓

Pages → unlimited reqs 🆓

R2  → 10M ops / month 🆓

D1  → private beta 🆓

Zero Trust → 50 users 🆓

 

Tracy X → 🤑💰🍺

TracyX [self hosted]

Time to selfie 📷

Thank you!

@xf3l1x
f3l1x.io

2022-11-26 - sentry - error logging in Nette

By Milan Felix Šulc

2022-11-26 - sentry - error logging in Nette

  • 369