0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
Commit Graph

17 Commits

Author SHA1 Message Date
Tom Owers
5513be7731
chore: upgraded Ruff linter (#18188)
* Upgraded Ruff linter

* Formatted whole codebase with new ruff rules

* Revert import removal

* Fixed mypi issues or added ignores

* Fixed schema formatting

* Fixed hogvm failing tests

* Remove duplicate key in list
2023-10-26 12:38:15 +02:00
Michael Matloka
5d2ad6c7bb
chore(deps): Update black to 22.8.0 (#11596)
* chore(deps): Update `black` to `22.8.0`

* Format
2022-09-05 14:38:54 +02:00
Harry Waye
45dc2aa032
Revert "Revert "chore(logging): use structlog for stdlib log and gunicorn"" (#11593)
Revert "Revert "chore(logging): use structlog for stdlib log and gunicorn" (#11580)"

This reverts commit 6e23fe7ae1.
2022-09-01 12:00:57 +00:00
Harry Waye
6e23fe7ae1
Revert "chore(logging): use structlog for stdlib log and gunicorn" (#11580)
Revert "chore(logging): use structlog for stdlib log and gunicorn (#11577)"

This reverts commit dc6e60d667.
2022-08-31 15:40:13 +01:00
Harry Waye
dc6e60d667
chore(logging): use structlog for stdlib log and gunicorn (#11577)
* chore(logging): use structlog for stdlib log and gunicorn

Change ensures that we have a common format for all log lines,
additionally adding e.g. pid and tid for gunicorn logs.

Previously there were large plain text log lines over multiple lines
that results in very awkward to logs when ingested into e.g. CloudWatch
or Loki, not least because these log apps typically show the most recent
line first.

* Update gunicorn.config.py

Co-authored-by: Guido Iaquinti <4038041+guidoiaquinti@users.noreply.github.com>

* remove print_warning

Co-authored-by: Guido Iaquinti <4038041+guidoiaquinti@users.noreply.github.com>
2022-08-31 14:01:57 +00:00
Harry Waye
ad590ea007
chore(gunicorn): reduce timeout from 90 seconds to 15 seconds (#11523)
This is not the request timeout, but rather the time between the worker
notifying the arbiter that it is still alive. This is runs in the main
loop of the [gthread
worker](https://labs.openai.com/s/YaxC326oohNreRzdYEzkmQdd) which should
be pretty tight.

We might even consider reducing this further.

TODO: allow these vars to be set by whatever is running this. There are
dependencies between this value and e.g. the downstream proxy server
timeouts.
2022-08-26 15:38:03 +00:00
Michael Matloka
b8652db777
feat(annotations): Annotations page 2.0 (#11482)
* style(annotations): Revamp Annotations page

* Add annotations to API builder

* Re-add base of annotation modal

* Update `LemonModal` and `IconClose` for visual polish

* Fix missing export

* Fix and align Date and time + Scope fields

* Hook up all the logic to the annotation modal

* Add annotations page story

* Fix typos

* Make date picker fit in

* Prevent ugly text wrapping

* Sync `AnnotationType` with API

* Clarify experience of insight-scoped annotations

* Restore Cypress instrumentation

* Fix typing

* Remove `data-tooltip`

* Rewrite Annotations page description

* Improve edge case with downgrading annotation scope

* Remove redundant function in logic
2022-08-26 13:38:32 +00:00
Harry Waye
f890ebee75
feat(metrics): expose Gunicorn socket/worker metrics via prometheus (#11502)
We add a couple of monitor threads:

 1. to monitor the number of connection requests that are yet to be
    accepted. This should give us an idea of how well the workers are
    getting through the requests. A backup here could suggest that the
    workers are completely saturated.
 2. to monitor the number of idle threads, and number of active
    connections the worker has.
2022-08-26 06:59:37 +01:00
Harry Waye
a70b4b28c6
chore(web): add django-prometheus exposed on /_metrics (#11000)
* chore(web): add django-prometheus exposed on /_metrics

This exposes a number of metrics, see
97d5748664/documentation/exports.md
for details. It includes histogram of timings by viewname before and
after middleware.

I'm not particularly interested in these right now, but rather would
like to expose Kafka Producer metrics as per
https://github.com/PostHog/posthog/pull/10997

* Refactor to use gunicorn server hooks

* also add expose to dockerfile

* wip
2022-07-27 20:37:44 +01:00
Guido Iaquinti
1d1d6d335c
flake8: enable E266,W291,W293,W391,W601 (#8699) 2022-02-21 15:47:27 +01:00
Karl-Aksel Puulmann
4094fb025f
Increase default timeouts from gunicorn (#4731)
These could explain some of the 5xx requests we've been having.
Deploying and measuring.
2021-06-14 10:39:04 +00:00
Karl-Aksel Puulmann
7a090a111c
Set gunicorn keepalive to 120 (seconds) (#4730)
We're hosting gunicorn behind an ELB with idle timeout of 120 seconds.

I think this is leading to sporatic 504 errors:

https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/ts-elb-error-message.html

> HTTP 504: Gateway timeout
> Cause 2: Registered instances closing the connection to Elastic Load Balancing.
> Solution 2: Enable keep-alive settings on your EC2 instances and make sure that the keep-alive timeout is greater than the idle timeout settings of your load balancer.

Related reading: https://serverfault.com/questions/782022/keepalive-setting-for-gunicorn-behind-elb-without-nginx

Not 100% this is appropriate for setups without ELB but let's deploy,
see if it makes a dent on monitoring and then move appropriately (e.g.
env variable this)
2021-06-14 13:21:11 +03:00
Marius Andra
da5a48c33d
Black all the things! (#1136)
* Black all the things!

* changed line length to 120
2020-07-02 15:41:49 +02:00
Marius Andra
9372d5f965 show the correct host and port 2020-04-02 00:55:45 +02:00
Marius Andra
e530e1d1df change localhost url in gunicorn help message 2020-04-02 00:54:38 +02:00
Karthikeyan Singaravelan
902003465f Fix deprecation warnings due to invalid escape sequences. 2020-02-21 21:52:11 +05:30
Tim Glaser
395d79f434 Faster dockerfile, with useful (and prettywelcome message 2020-02-09 12:21:06 -08:00