首页 > 解决方案 > 如何确保哨兵正在捕获我的异常?

问题描述

我在一个新的 laravel 项目中实现了哨兵。发送测试异常似乎工作正常:

root@d816d48eed86:/app# php artisan sentry:test
[sentry] Client DSN discovered!
[sentry] Generating test event
[sentry] Sending test event
[sentry] Event sent with ID: d88ff2add86342989da27a8c75ec0562

我还可以看到哨兵网络服务器收到了它:

sentry_1     | 10.10.65.1 - - [12/Nov/2019:09:05:12 +0000] "POST /api/35/store/ HTTP/1.0" 200 366 "-" "sentry.php.laravel/1.4.1"

但是,异常从未出现在哨兵中。

我正在使用sentry/sentry-laravelv1.4.1 包。

我该如何调试呢?

标签: laravelsentry

解决方案


事实证明,仅仅启动一个哨兵容器是不够的。您还必须启动运行 cron 和工作容器的容器:

  sentry:
    image: sentry:9
    restart: unless-stopped
    environment:
      <<: *sentry-config
    links:
      - postgres
      - memcached
      - redis
    ports:
      - "9000"
  cron:
    image: sentry:9
    links:
     - redis
     - postgres
    command: "sentry run cron"
    environment:
      <<: *sentry-config
  worker:
    image: sentry
    links:
     - redis
     - postgres
    command: "sentry run worker"
    environment:
      <<: *sentry-config
    postgres:
    image: postgres:11
    restart: unless-stopped
    environment:
      - POSTGRES_USER=sentry
      - POSTGRES_DB=sentry
      - POSTGRES_PASSWORD=sentry
  redis:
    image: redis:5-alpine
    restart: unless-stopped
  memcached:
    image: memcached:1.5-alpine
    restart: unless-stopped

推荐阅读