成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Sentry 監控 - Snuba 數據中臺本地開發環境配置實戰

安全 應用安全 中臺
如果您的開發機器沒有運行上述系統之一,則需要安裝 Rust 工具鏈。按照 https://www.rust-lang.org/tools/install 上的說明安裝編譯器和相關工具。安裝后,Sentry 安裝程序將自動使用 Rust 構建所有二進制模塊,無需額外配置。

[[437983]]

本文轉載自微信公眾號「黑客下午茶」,作者為少 。轉載本文請聯系黑客下午茶公眾號。

克隆倉庫

分別克隆 getsentry/sentry 與 getsentry/snuba:

git clone https://github.com/getsentry/sentry.git

git clone https://github.com/getsentry/snuba.git

安裝系統依賴(以 Mac 為例)

Xcode CLI tools

  1. xcode-select --install 

Brewfile

進入 sentry 文件夾,你會看到一個 Brewfile 文件:

  1. cd sentry 

Brewfile

  1. # required to run devservices 
  2. cask 'docker' 
  3.  
  4. brew 'pyenv' 
  5.  
  6. # required for pyenv's python-build 
  7. brew 'openssl' 
  8. brew 'readline' 
  9.  
  10. # required for yarn test -u 
  11. brew 'watchman' 
  12.  
  13. # required to build some of sentry's dependencies 
  14. brew 'pkgconfig' 
  15. brew 'libxslt' 
  16. brew 'libxmlsec1' 
  17. brew 'geoip' 
  18.  
  19. # Currently needed because on Big Sur there's no wheel for it 
  20. brew 'librdkafka' 
  21.  
  22. # direnv isn't defined here, because we have it configured to check for a bootstrapped environment. 
  23. # If it's installed in the early steps of the setup process, it just leads to confusion. 
  24. # brew 'direnv' 
  25.  
  26. tap 'homebrew/cask' 
  27.  
  28. # required for acceptance testing 
  29. cask 'chromedriver' 

如果你本地已經安裝了 Docker Desktop 并且已經啟動,可以把 cask 'docker' 注釋掉。

接下來,運行:

  1. brew bundle --verbose 

如果你之前本地沒有 Docker Desktop,則還需要手動啟動一下它:

  1. open -g -a Docker.app 

構建工具鏈

Sentry 依賴于 Python Wheels(包含二進制擴展模塊的包),官方為以下平臺分發:

  • Linux 兼容 PEP-513 (manylinux1)
  • macOS 10.15 或更高版本

如果您的開發機器沒有運行上述系統之一,則需要安裝 Rust 工具鏈。按照 https://www.rust-lang.org/tools/install 上的說明安裝編譯器和相關工具。安裝后,Sentry 安裝程序將自動使用 Rust 構建所有二進制模塊,無需額外配置。

官方通常會跟蹤最新的穩定 Rust 版本,該版本每六周更新一次。因此,請確保通過偶爾運行來使您的 Rust 工具鏈保持最新:

  1. rustup update stable 

Python

Sentry 使用 pyenv 來安裝和管理 Python 版本。它是在您運行 brew bundle 時安裝的。

要安裝所需版本的 Python,您需要運行以下命令。這將需要一段時間,因為您的計算機實際上正在編譯 Python!

  1. make setup-pyenv 

這里假設你是 Zsh 用戶。

如果您鍵入 which python,您應該看到類似 $HOME/.pyenv/shims/python 而不是 /usr/bin/python 的內容。這是因為以下內容已添加到您的啟動腳本中:

cat ~/.zprofile,你會看到如下內容:

  1. # MacPorts Installer addition on 2021-10-20_at_11:48:22: adding an appropriate PATH variable for use with MacPorts. 
  2. export PATH="/opt/local/bin:/opt/local/sbin:$PATH" 
  3. # Finished adapting your PATH environment variable for use with MacPorts. 
  4.  
  5. # It is assumed that pyenv is installed via Brew, so this is all we need to do. 
  6. eval "$(pyenv init --path)" 

虛擬環境

您現在已準備好創建 Python 虛擬環境。運行:

  1. python -m venv .venv 

并激活虛擬環境:

  1. source .venv/bin/activate 

如果一切正常,運行 which python 現在應該會導致類似 /Users/you/sentry/.venv/bin/python 的結果。

Snuba 配置實戰

啟動 Snuba 相關依賴項容器

 

  1. cd ../sentry 
  2. git checkout master 
  3. git pull 
  4.  
  5. source .venv/bin/activate 
  6. sentry devservices up --exclude=snuba 
  7.  
  8. # 11:17:59 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured. 
  9. # 11:18:01 [INFO] sentry.plugins.github: apps-not-configured 
  10. # > Pulling image 'postgres:9.6-alpine' 
  11. # > Pulling image 'yandex/clickhouse-server:20.3.9.70' 
  12. # > Not starting container 'sentry_relay' because it should be started on-demand with devserver. 
  13. # > Creating 'sentry_redis' volume 
  14. # > Creating 'sentry_zookeeper_6' volume 
  15. # > Creating 'sentry_kafka_6' volume 
  16. # > Creating container 'sentry_redis' 
  17. # > Creating container 'sentry_zookeeper' 
  18. # > Creating container 'sentry_kafka' 
  19. # > Starting container 'sentry_redis' (listening: ('127.0.0.1', 6379)) 
  20. # > Starting container 'sentry_kafka' (listening: ('127.0.0.1', 9092)) 
  21. # > Starting container 'sentry_zookeeper' 
  22. # > Creating 'sentry_clickhouse' volume 
  23. # > Creating container 'sentry_clickhouse' 
  24. # > Creating 'sentry_postgres' volume 
  25. # > Creating 'sentry_wal2json' volume 
  26. # > Starting container 'sentry_clickhouse' (listening: ('127.0.0.1', 9000), ('127.0.0.1', 9009), ('127.0.0.1', 8123)) 
  27. # > Creating container 'sentry_postgres' 
  28. # > Starting container 'sentry_postgres' (listening: ('127.0.0.1', 5432)) 

這將在 master 上獲取最新版本的 Sentry,并調出所有 snuba 的依賴項。

Snuba 主要依賴 clickhouse,zookeeper,kafka,redis 相關容器。

docker ps 查看一下:

  1. 1149a6f6ff23   postgres:9.6-alpine                  "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes   127.0.0.1:5432->5432/tcp                                                       sentry_postgres 
  2. a7f3af7d52bb   yandex/clickhouse-server:20.3.9.70   "/entrypoint.sh"         3 minutes ago   Up 3 minutes   127.0.0.1:8123->8123/tcp, 127.0.0.1:9000->9000/tcp, 127.0.0.1:9009->9009/tcp   sentry_clickhouse 
  3. 68913ee15c43   confluentinc/cp-zookeeper:6.2.0      "/etc/confluent/dock…"   3 minutes ago   Up 3 minutes   2181/tcp, 2888/tcp, 3888/tcp                                                   sentry_zookeeper 
  4. 5a248eb26ed3   confluentinc/cp-kafka:6.2.0          "/etc/confluent/dock…"   3 minutes ago   Up 3 minutes   127.0.0.1:9092->9092/tcp                                                       sentry_kafka 
  5. 0573aff7b5af   redis:5.0-alpine                     "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes   127.0.0.1:6379->6379/tcp                                                       sentry_redis 

設置 Snuba 虛擬環境

  1. cd snuba 
  2. make pyenv-setup 
  3. python -m venv .venv 
  4. source .venv/bin/activate 
  5. pip install --upgrade pip==21.1.3 
  6. make develop 

查看遷移列表

  1. snuba migrations list 
  2. #  system 
  3. #  [ ]  0001_migrations 
  4. #  events 
  5. #  [ ]  0001_events_initial 
  6. #  [ ]  0002_events_onpremise_compatibility 
  7. #  [ ]  0003_errors 
  8. #  [ ]  0004_errors_onpremise_compatibility 
  9. #  [ ]  0005_events_tags_hash_map (blocking) 
  10. #  [ ]  0006_errors_tags_hash_map (blocking) 
  11. #  [ ]  0007_groupedmessages 
  12. #  [ ]  0008_groupassignees 
  13. #  [ ]  0009_errors_add_http_fields 
  14. #  [ ]  0010_groupedmessages_onpremise_compatibility (blocking) 
  15. #  [ ]  0011_rebuild_errors 
  16. #  [ ]  0012_errors_make_level_nullable 
  17. #  [ ]  0013_errors_add_hierarchical_hashes 
  18. #  [ ]  0014_backfill_errors (blocking) 
  19. #  [ ]  0015_truncate_events 
  20. #  transactions 
  21. #  [ ]  0001_transactions 
  22. #  [ ]  0002_transactions_onpremise_fix_orderby_and_partitionby (blocking) 
  23. #  [ ]  0003_transactions_onpremise_fix_columns (blocking) 
  24. #  [ ]  0004_transactions_add_tags_hash_map (blocking) 
  25. #  [ ]  0005_transactions_add_measurements 
  26. #  [ ]  0006_transactions_add_http_fields 
  27. #  [ ]  0007_transactions_add_discover_cols 
  28. #  [ ]  0008_transactions_add_timestamp_index 
  29. #  [ ]  0009_transactions_fix_title_and_message 
  30. #  [ ]  0010_transactions_nullable_trace_id 
  31. #  [ ]  0011_transactions_add_span_op_breakdowns 
  32. #  [ ]  0012_transactions_add_spans 
  33. #  discover 
  34. #  [ ]  0001_discover_merge_table 
  35. #  [ ]  0002_discover_add_deleted_tags_hash_map 
  36. #  [ ]  0003_discover_fix_user_column 
  37. #  [ ]  0004_discover_fix_title_and_message 
  38. #  [ ]  0005_discover_fix_transaction_name 
  39. #  [ ]  0006_discover_add_trace_id 
  40. #  [ ]  0007_discover_add_span_id 
  41. #  outcomes 
  42. #  [ ]  0001_outcomes 
  43. #  [ ]  0002_outcomes_remove_size_and_bytes 
  44. #  [ ]  0003_outcomes_add_category_and_quantity 
  45. #  [ ]  0004_outcomes_matview_additions (blocking) 
  46. #  metrics 
  47. #  [ ]  0001_metrics_buckets 
  48. #  [ ]  0002_metrics_sets 
  49. #  [ ]  0003_counters_to_buckets 
  50. #  [ ]  0004_metrics_counters 
  51. #  [ ]  0005_metrics_distributions_buckets 
  52. #  [ ]  0006_metrics_distributions 
  53. #  [ ]  0007_metrics_sets_granularity_10 
  54. #  [ ]  0008_metrics_counters_granularity_10 
  55. #  [ ]  0009_metrics_distributions_granularity_10 
  56. #  [ ]  0010_metrics_sets_granularity_1h 
  57. #  [ ]  0011_metrics_counters_granularity_1h 
  58. #  [ ]  0012_metrics_distributions_granularity_1h 
  59. #  [ ]  0013_metrics_sets_granularity_1d 
  60. #  [ ]  0014_metrics_counters_granularity_1d 
  61. #  [ ]  0015_metrics_distributions_granularity_1d 
  62. #  sessions 
  63. #  [ ]  0001_sessions 
  64. #  [ ]  0002_sessions_aggregates 
  65. #  [ ]  0003_sessions_matview 

運行遷移

  1. snuba migrations migrate --force 
  2. #  ...... 
  3. #  2021-12-01 19:45:57,557 Running migration: 0014_metrics_counters_granularity_1d 
  4. #  2021-12-01 19:45:57,575 Finished: 0014_metrics_counters_granularity_1d 
  5. #  2021-12-01 19:45:57,589 Running migration: 0015_metrics_distributions_granularity_1d 
  6. #  2021-12-01 19:45:57,610 Finished: 0015_metrics_distributions_granularity_1d 
  7. #  2021-12-01 19:45:57,623 Running migration: 0001_sessions 
  8. #  2021-12-01 19:45:57,656 Finished: 0001_sessions 
  9. #  2021-12-01 19:45:57,669 Running migration: 0002_sessions_aggregates 
  10. #  2021-12-01 19:45:57,770 Finished: 0002_sessions_aggregates 
  11. #  2021-12-01 19:45:57,792 Running migration: 0003_sessions_matview 
  12. #  2021-12-01 19:45:57,849 Finished: 0003_sessions_matview 
  13. #  Finished running migrations 

檢查遷移

進入 Clickhouse 容器:

  1. docker exec -it sentry_clickhouse clickhouse-client 
  2. # 運行如下 `sql` 語句: 
  3. select count() from sentry_local 
  4.  
  5. # ClickHouse client version 20.3.9.70 (official build). 
  6. # Connecting to localhost:9000 as user default
  7. # Connected to ClickHouse server version 20.3.9 revision 54433. 
  8.  
  9. # a7f3af7d52bb :) select count() from sentry_local 
  10.  
  11. SELECT count() 
  12. FROM sentry_local 
  13.  
  14. # ┌─count()─┐ 
  15. # │       0 │ 
  16. # └─────────┘ 
  17.  
  18. # 1 rows in set. Elapsed: 0.008 sec.  
  19.  
  20. # a7f3af7d52bb :) 

查看相關實體數據集

  1. snuba entities list 
  2.  
  3. # Declared Entities: 
  4. # discover 
  5. # events 
  6. # groups 
  7. # groupassignee 
  8. # groupedmessage 
  9. # metrics_sets 
  10. # metrics_counters 
  11. # metrics_distributions 
  12. # outcomes 
  13. # outcomes_raw 
  14. # sessions 
  15. # org_sessions 
  16. # spans 
  17. # transactions 
  18. # discover_transactions 
  19. # discover_events 

啟動開發服務器

此命令將啟動 api 和所有 Snuba 消費者以從 Kafka 攝取數據:

  1. snuba devserver 

轉到 http://localhost:1218/events/snql,你將會看到一個簡易的查詢 UI。

 

責任編輯:武曉燕 來源: 黑客下午茶
相關推薦

2021-11-26 18:53:53

監控數據中臺

2021-10-09 23:33:55

監控

2021-10-11 19:36:08

監控Sentry架構

2021-10-09 00:00:40

Sentr 監控架構

2021-11-27 23:54:44

監控Snuba數據

2021-09-29 07:47:49

Sentry 監控Environment事件數據

2021-12-31 18:35:40

監控Sentry開發

2021-12-25 22:31:55

Sentry 監控SDK 開發 性能監控

2021-09-14 23:50:17

Sentry后端監控

2021-09-27 19:41:31

監控Sentry Alerts

2022-01-15 23:33:47

SentryPyCharm配置

2021-09-26 16:20:04

Sentry Dashboards 數據可視化

2021-09-13 05:00:09

監控Trends 性能

2021-09-11 21:02:24

監控Sentry Web性能

2011-06-13 13:06:48

Gtk Qt

2013-01-25 14:08:32

S40Series 40

2021-09-16 23:33:41

大數據Sentry監控

2023-02-13 11:43:15

云原生中間件負載均衡

2022-01-03 22:59:30

開發SDK數據

2021-09-09 12:28:50

Sentry Web性能監控
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 日韩精品一区二区三区视频播放 | 色婷婷激情综合 | 久久躁日日躁aaaaxxxx | www久久国产 | 91网站在线观看视频 | 日本高清视频在线播放 | 久久久精品久久 | 欧美日韩高清在线观看 | 亚洲热在线视频 | 欧美激情一区二区三区 | 午夜网站视频 | 欧美一区二区三区精品免费 | 日韩欧美精品一区 | 亚洲精品久久久一区二区三区 | 国产女人与拘做受免费视频 | 亚洲欧美视频 | 成人在线播放 | 看片91| 一区二区三区小视频 | 亚洲国产成人精品久久久国产成人一区 | 欧美日本一区 | 不卡一区二区三区四区 | a级免费黄色片 | 视频一区二区在线观看 | 亚洲国产一区在线 | 久久久成人一区二区免费影院 | 99久久成人| 欧美一区二 | 一区| 九九在线视频 | 国产乱人伦 | 国产熟熟| 久久精品99 | 热99在线 | 99精品视频在线 | 日韩在线一区二区三区 | 欧美成人影院 | 人人天天操 | 91看国产| www.国产精品 | 亚洲一区二区三区免费视频 |