Zulip 服务器和 Web 应用程序。开源团队聊天可帮助团队保持高效和专注。
Go to file
Alex Vandiver 9b1bdfefcd nagios: Use a better index on UserActivity for zephyr alerting.
Limiting only by client_name and query leads to a very poorly-indexed
lookup on `query` which throws out nearly all of its rows:

```
Nested Loop  (cost=50885.64..60522.96 rows=821 width=8)
  ->  Index Scan using zerver_client_name_key on zerver_client  (cost=0.28..2.49 rows=1 width=4)
        Index Cond: ((name)::text = 'zephyr_mirror'::text)
  ->  Bitmap Heap Scan on zerver_useractivity  (cost=50885.37..60429.95 rows=9052 width=12)
        Recheck Cond: ((client_id = zerver_client.id) AND ((query)::text = ANY ('{get_events,/api/v1/events}'::text[])))
        ->  BitmapAnd  (cost=50885.37..50885.37 rows=9052 width=0)
              ->  Bitmap Index Scan on zerver_useractivity_2bfe9d72  (cost=0.00..16631.82 rows=..large.. width=0)
                    Index Cond: (client_id = zerver_client.id)
              ->  Bitmap Index Scan on zerver_useractivity_1b1cc7f0  (cost=0.00..34103.95 rows=..large.. width=0)
                    Index Cond: ((query)::text = ANY ('{get_events,/api/v1/events}'::text[]))
```

A partial index on the client and query list is extremely effective
here in reducing PostgreSQL's workload; however, we cannot easily
write it as a migration, since it depends on the value of the ID of
the `zephyr_mirror` client.

Since this is only relevant for Zulip Cloud, we manually create the
index:

```sql
CREATE INDEX CONCURRENTLY zerver_useractivity_zehpyr_liveness
    ON zerver_useractivity(last_visit)
 WHERE client_id = 1005
   AND query IN ('get_events', '/api/v1/events');
```

We rewrite the query to do the time limit, distinct, and count in SQL,
instead of Python, and make use of this index.  This turns a 20-second
query into two 10ms queries.
2023-11-30 16:01:55 -08:00
.github ci: Add a test for upgrading from 7.0. 2023-11-29 13:57:33 -08:00
.tx provision: Replace transifex-client with new transifex-cli. 2022-12-13 12:34:08 -08:00
.vscode vscode: Recommend remote development extension. 2021-11-03 16:03:46 -07:00
analytics billing: Add BILLING_SCHEDULE_ prefix to values. 2023-11-29 23:32:56 -08:00
api_docs notifications: Rename push_notifications_enabled for clarity. 2023-11-29 15:06:46 -08:00
confirmation mypy: Enable new error explicit-override. 2023-10-12 12:28:41 -07:00
corporate remote_billing: Implement session expiry mechanism. 2023-11-30 15:51:10 -08:00
docs push bouncer: Submit basic metadata unconditionally. 2023-11-29 14:45:53 -08:00
help help: Document license management and downgrades. 2023-11-30 08:36:15 -08:00
locale i18n: Update translation data from Transifex. 2023-11-15 18:01:47 -08:00
patches dependencies: Patch source-sans to correct format() for variable fonts. 2023-09-13 17:08:53 -07:00
pgroonga migrations: Import BaseDatabaseSchemaEditor from its canonical module. 2023-03-05 14:46:28 -08:00
puppet nagios: Use a better index on UserActivity for zephyr alerting. 2023-11-30 16:01:55 -08:00
requirements requirements: Support multiple APNs topics in aioapns. 2023-11-16 12:03:30 -08:00
scripts queue: Increase paging thresholds for deferred_work queue. 2023-11-09 13:51:00 -08:00
static help: Document new polls UI. 2023-11-30 08:32:38 -08:00
stubs/taint actions: Split out zerver.actions.message_send. 2022-04-14 17:14:34 -07:00
templates billing: Add BILLING_SCHEDULE_ prefix to values. 2023-11-29 23:32:56 -08:00
tools emoji: Use individual images for fallback emoji instead of spritesheet. 2023-11-29 16:04:07 -08:00
var/puppeteer puppeteer_tests: Port to TypeScript. 2021-02-22 16:03:10 -08:00
web zulip-icons: Use WOFF2 format for icon font. 2023-11-30 16:00:53 -08:00
zerver stream_traffic: Use the realm_id to get a much better-indexed query. 2023-11-30 12:32:30 -08:00
zilencer models: Allow realm_id to be blank. 2023-11-30 11:22:19 -08:00
zproject send_email: Improve configurability for outgoing email sender name. 2023-11-29 14:20:01 -08:00
.codecov.yml codecov: Change threshold to use percentage syntax. 2019-07-20 14:37:04 -07:00
.codespellignore codespell: Fix newly found typos. 2023-04-03 22:39:21 -07:00
.editorconfig editorconfig: Restore indent_size = 2 for Markdown. 2021-08-20 23:14:37 -07:00
.eslintignore web: Move web app to ‘web’ directory. 2023-02-23 16:04:17 -08:00
.eslintrc.json eslint: Forbid unchecked casts in TypeScript. 2023-10-26 09:54:30 -07:00
.gitattributes .gitattributes: Mark *.bmp, *.bson, *.mp3, *.pdf as binary. 2022-02-07 18:51:06 -08:00
.gitignore push_notifs: Support APNs token auth, as well as cert auth. 2023-11-16 12:03:30 -08:00
.gitlint lint: Update line-length for commit message to 72 in gitlint. 2023-05-01 10:35:52 -07:00
.mailmap mailmap: Put sorted list back in order. 2023-08-02 17:19:05 -07:00
.npmignore Add proxy notes to new README.dev.md troubleshooting section. 2016-03-29 21:54:05 -07:00
.npmrc dependencies: Switch to pnpm. 2023-03-20 15:48:29 -07:00
.prettierignore dependencies: Switch to pnpm. 2023-03-20 15:48:29 -07:00
.pyre_configuration pysa: Update .pyre_configuration to point to typeshed. 2020-09-22 15:44:47 -07:00
.readthedocs.yaml readthedocs: Add a configuration file. 2023-02-03 16:36:54 -08:00
.sonarcloud.properties tools: Configure Zulip to be scannable by SonarCloud. 2020-06-24 12:41:17 -07:00
CODE_OF_CONDUCT.md docs: Rename "private message" -> "direct message". 2023-06-23 14:36:16 -07:00
CONTRIBUTING.md contributor docs: Explain what to do if issue assignee is unresponsive. 2023-10-16 13:28:23 -07:00
Dockerfile-postgresql docs: Fix grammar errors found by mwic. 2023-10-09 13:24:09 -07:00
LICENSE license: Move copyright notice from LICENSE to NOTICE. 2021-02-05 09:28:12 -08:00
manage.py mypy: Enable new error explicit-override. 2023-10-12 12:28:41 -07:00
NOTICE docs: Bump copyright year. 2021-02-05 09:28:15 -08:00
package.json people: Remove final use of date-fns-tz. 2023-11-19 15:21:34 -08:00
pnpm-lock.yaml people: Remove final use of date-fns-tz. 2023-11-19 15:21:34 -08:00
prettier.config.js prettier: Disable embedded language formatting for Markdown. 2021-08-20 23:14:37 -07:00
pyproject.toml docs: Update Ruff badge and links. 2023-10-26 15:51:46 -07:00
README.md docs: Update Ruff badge and links. 2023-10-26 15:51:46 -07:00
SECURITY.md docs: Update .html links pointing to "Upgrade Zulip" or "Modify Zulip". 2023-08-11 16:49:32 -07:00
stylelint.config.js dependencies: Upgrade JavaScript dependencies. 2023-07-21 15:58:42 -07:00
tsconfig.json dependencies: Install `@types/jquery.validation for type annotation. 2023-08-14 16:00:20 -07:00
Vagrantfile vagrant: Add Fedora 36 support. 2022-09-08 16:12:59 -07:00
version.py version: Fix incorrect API_FEATURE_LEVEL. 2023-11-30 08:28:52 -08:00

Zulip overview

Zulip is an open-source team collaboration tool with unique topic-based threading that combines the best of email and chat to make remote work productive and delightful. Fortune 500 companies, leading open source projects, and thousands of other organizations use Zulip every day. Zulip is the only modern team chat app that is designed for both live and asynchronous conversations.

Zulip is built by a distributed community of developers from all around the world, with 74+ people who have each contributed 100+ commits. With over 1000 contributors merging over 500 commits a month, Zulip is the largest and fastest growing open source team chat project.

Come find us on the development community chat!

GitHub Actions build status coverage status Mypy coverage Ruff code style: black code style: prettier GitHub release docs Zulip chat Twitter GitHub Sponsors

Getting started

You may also be interested in reading our blog, and following us on Twitter and LinkedIn.

Zulip is distributed under the Apache 2.0 license.