自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Sentry 監(jiān)控 - Snuba 數(shù)據(jù)中臺(tái)本地開(kāi)發(fā)環(huán)境配置實(shí)戰(zhàn)

安全 應(yīng)用安全 中臺(tái)
如果您的開(kāi)發(fā)機(jī)器沒(méi)有運(yùn)行上述系統(tǒng)之一,則需要安裝 Rust 工具鏈。按照 https://www.rust-lang.org/tools/install 上的說(shuō)明安裝編譯器和相關(guān)工具。安裝后,Sentry 安裝程序?qū)⒆詣?dòng)使用 Rust 構(gòu)建所有二進(jìn)制模塊,無(wú)需額外配置。

[[437983]]

本文轉(zhuǎn)載自微信公眾號(hào)「黑客下午茶」,作者為少 。轉(zhuǎn)載本文請(qǐng)聯(lián)系黑客下午茶公眾號(hào)。

克隆倉(cāng)庫(kù)

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

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

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

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

Xcode CLI tools

  1. xcode-select --install 

Brewfile

進(jìn)入 sentry 文件夾,你會(huì)看到一個(gè) 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' 

如果你本地已經(jīng)安裝了 Docker Desktop 并且已經(jīng)啟動(dòng),可以把 cask 'docker' 注釋掉。

接下來(lái),運(yùn)行:

  1. brew bundle --verbose 

如果你之前本地沒(méi)有 Docker Desktop,則還需要手動(dòng)啟動(dòng)一下它:

  1. open -g -a Docker.app 

構(gòu)建工具鏈

Sentry 依賴于 Python Wheels(包含二進(jìn)制擴(kuò)展模塊的包),官方為以下平臺(tái)分發(fā):

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

如果您的開(kāi)發(fā)機(jī)器沒(méi)有運(yùn)行上述系統(tǒng)之一,則需要安裝 Rust 工具鏈。按照 https://www.rust-lang.org/tools/install 上的說(shuō)明安裝編譯器和相關(guān)工具。安裝后,Sentry 安裝程序?qū)⒆詣?dòng)使用 Rust 構(gòu)建所有二進(jìn)制模塊,無(wú)需額外配置。

官方通常會(huì)跟蹤最新的穩(wěn)定 Rust 版本,該版本每六周更新一次。因此,請(qǐng)確保通過(guò)偶爾運(yùn)行來(lái)使您的 Rust 工具鏈保持最新:

  1. rustup update stable 

Python

Sentry 使用 pyenv 來(lái)安裝和管理 Python 版本。它是在您運(yùn)行 brew bundle 時(shí)安裝的。

要安裝所需版本的 Python,您需要運(yùn)行以下命令。這將需要一段時(shí)間,因?yàn)槟挠?jì)算機(jī)實(shí)際上正在編譯 Python!

  1. make setup-pyenv 

這里假設(shè)你是 Zsh 用戶。

如果您鍵入 which python,您應(yīng)該看到類似 $HOME/.pyenv/shims/python 而不是 /usr/bin/python 的內(nèi)容。這是因?yàn)橐韵聝?nèi)容已添加到您的啟動(dòng)腳本中:

cat ~/.zprofile,你會(huì)看到如下內(nèi)容:

  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)" 

虛擬環(huán)境

您現(xiàn)在已準(zhǔn)備好創(chuàng)建 Python 虛擬環(huán)境。運(yùn)行:

  1. python -m venv .venv 

并激活虛擬環(huán)境:

  1. source .venv/bin/activate 

如果一切正常,運(yùn)行 which python 現(xiàn)在應(yīng)該會(huì)導(dǎo)致類似 /Users/you/sentry/.venv/bin/python 的結(jié)果。

Snuba 配置實(shí)戰(zhàn)

啟動(dòng) Snuba 相關(guān)依賴項(xiàng)容器

 

  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,并調(diào)出所有 snuba 的依賴項(xiàng)。

Snuba 主要依賴 clickhouse,zookeeper,kafka,redis 相關(guān)容器。

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 

設(shè)置 Snuba 虛擬環(huán)境

  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 

運(yùn)行遷移

  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 

檢查遷移

進(jìn)入 Clickhouse 容器:

  1. docker exec -it sentry_clickhouse clickhouse-client 
  2. # 運(yùn)行如下 `sql` 語(yǔ)句: 
  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 :) 

查看相關(guān)實(shí)體數(shù)據(jù)集

  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 

啟動(dòng)開(kāi)發(fā)服務(wù)器

此命令將啟動(dòng) api 和所有 Snuba 消費(fèi)者以從 Kafka 攝取數(shù)據(jù):

  1. snuba devserver 

轉(zhuǎn)到 http://localhost:1218/events/snql,你將會(huì)看到一個(gè)簡(jiǎn)易的查詢 UI。

 

責(zé)任編輯:武曉燕 來(lái)源: 黑客下午茶
相關(guān)推薦

2021-11-26 18:53:53

監(jiān)控數(shù)據(jù)中臺(tái)

2021-10-11 19:36:08

監(jiān)控Sentry架構(gòu)

2021-10-09 23:33:55

監(jiān)控

2021-10-09 00:00:40

Sentr 監(jiān)控架構(gòu)

2021-11-27 23:54:44

監(jiān)控Snuba數(shù)據(jù)

2021-09-29 07:47:49

Sentry 監(jiān)控Environment事件數(shù)據(jù)

2021-12-31 18:35:40

監(jiān)控Sentry開(kāi)發(fā)

2021-12-25 22:31:55

Sentry 監(jiān)控SDK 開(kāi)發(fā) 性能監(jiān)控

2022-01-15 23:33:47

SentryPyCharm配置

2021-09-14 23:50:17

Sentry后端監(jiān)控

2021-09-27 19:41:31

監(jiān)控Sentry Alerts

2021-09-26 16:20:04

Sentry Dashboards 數(shù)據(jù)可視化

2011-06-13 13:06:48

Gtk Qt

2021-09-13 05:00:09

監(jiān)控Trends 性能

2021-09-11 21:02:24

監(jiān)控Sentry Web性能

2013-01-25 14:08:32

S40Series 40

2021-09-16 23:33:41

大數(shù)據(jù)Sentry監(jiān)控

2010-05-12 16:24:32

Black Berry

2021-09-09 12:28:50

Sentry Web性能監(jiān)控

2022-01-03 22:59:30

開(kāi)發(fā)SDK數(shù)據(jù)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)