Baseplate

Latest version: v2.6.0

Safety actively analyzes 629723 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 15 of 24

1.2.4

This release has a single bugfix for a regression caused in the 1.1 series:

* Fix regression in deprecated queue consumer when internal work queue is empty (432)

1.2.3

Bug fixes

* Fix some crashes that might happen if an observer raises an exception during `on_start()` (415)
* Send queue consumer healthcheck logging through the proper logging system rather than to stderr (424)
* Fix the response type of the queue consumer healthcheck to match baseplate standard (425)

1.2.2

Bug Fixes

This release fixes thrift connection pool resource leaks that can happen when server timeouts fire while the application is allocating or releasing connections. (421)

1.2.1

Changes

* redis-py 3.0+ is now supported. (393)
* When sending trace data, convert boolean tags to strings. This allows wavefront to parse those values. (401, 402)
* Device ID is now included in the edge context (404)

Bug fixes

* Fix crash in Pyramid integration when request parsing fails very early (395)
* Various typos and mistakes in the documentation (406, 407)

1.2.0

New Features

Server Timeouts

Baseplate.py servers will now time out requests that are taking too long. This is useful because often the upstream client has timed out already and the server is just wasting processing by continuing to work on the request. Timeouts are configurable as a cross-service default and per-endpoint.

**Note: all requests will now time out after a default 10 seconds. See the documentation to configure this for your service.**

[See the documentation for more information](https://baseplate.readthedocs.io/en/v1.2.0/api/baseplate/observers/timeout.html).

See 375

External callbacks from the Secret Fetcher

The secret fetcher daemon can now call an external executable after every time the secrets file is updated. This can be used to transform the secrets JSON into a format needed by non-baseplate services like nginx etc. and even do things like reload those services after changes.

[See the documentation for more information](https://github.com/reddit/baseplate.py/blob/1ca8488bcd42c8786e6a3db35b2a99517fd07a99/baseplate/sidecars/secrets_fetcher.py#L57-L60)

See 380

Changes

* The authentication token from edge context now has extra fields for `loid`, `loid_created_ms`, and `scopes`. (See 371)
* Simplify passing `app_config` to the `Baseplate` object and its calls. (See 375)
* The `active_requests` metric now tracks requests rather than connections. Previously, it counted all open connections to the service which would include any idle ones. The original metric is still available as `open_connections`. (See 376)
* `baseplate-tshell` has been renamed to `baseplate-shell` and can be used for all types of services, including Pyramid. (See 369)
* Performance improvements when validating invalid message signatures. (152bb8384).
* The `max_concurrency` setting on Thrift and WSGI servers is now deprecated. [See here for more information](https://github.com/reddit/baseplate.py-upgrader/wiki/v1.2#max_concurrency-is-deprecated). (`max_concurrency` is not deprecated for queue consumers) (See 382)

Bug Fixes

* Fix imports in generated thrift remote when `setup.py build` is run multiple times. (See 373)
* Fix an infinite loop when setting up Sentry's Raven client in a subdirectory via relative paths. (See 374)

Upgrading

No code or configuration changes are strictly required to upgrade, but there are some things to pay attention to.

Concurrency and timeouts

Without any other code changes, two things will happen:

* All requests will get a 10 second default timeout.
* You'll get a deprecation warning about the `max_concurrency` setting in your server config.

You can configure stricter timeouts to improve your service's resiliency, see [the timeout documentation for more information](https://baseplate.readthedocs.io/en/v1.2.0/api/baseplate/observers/timeout.html).

Once you've deployed, you can remove the `max_concurrency` setting to get rid of its sharp edges. (Don't do it until the code's fully out as it's required by Baseplate.py 1.1 and below).

Optional application startup change

An unrelated optional change you can make reduces some boilerplate during application startup and might make future framework-level settings more automatic:

diff
--- a/my_service/__init__.py
+++ b/my_service/__init__.py
-107,9 +107,9 class Handler:
def make_processor(app_config: config.RawConfig) -> TProcessor: pragma: nocover
cfg = config.parse_config(app_config, {"activity": {"window": config.Timespan}})

- baseplate = Baseplate()
- baseplate.configure_observers(app_config)
- baseplate.configure_context(app_config, {"redis": RedisClient(timeout=0.1)})
+ baseplate = Baseplate(app_config)
+ baseplate.configure_observers()
+ baseplate.configure_context({"redis": RedisClient(timeout=0.1)})

1.1.0

New Features

Linting Framework

Running a good linter on your code catches bugs before they make it to production and reduces the burden on reviewers. Baseplate.py now has a framework for packaging up linters beyond what come from industry-wide tooling to include extra checks specific to the Baseplate ecosystem. The first custom check looks for incorrect use of format strings in database queries. Many more are to come and your additions are more than welcome!

To use this, just add `load-plugins=baseplate.lint` to your `pylintrc`.

(See 356)

First-Class Queue Consumers

Baseplate.py services have been consuming queues by executing the queue consumer code from `baseplate-script`. This worked, but meant that we didn't get all of the extra niceties of `baseplate-serve` like graceful shutdown and healthchecks. There is now a new "server" type for queue consumers that is run with `baseplate-serve` and provides a healthcheck responder, automatic handling of graceful shutdown, can consume many messages concurrently, and works with different kinds of consumers including AMQP. The old method is still available but is now deprecated.

(See 355, and 363)

Kafka Consumer

Hot on the heels of the new system for running queue consumers, Baseplate.py now supports consuming from Kafka!

(See 366)

Changes

* Graceful shutdown now defaults to waiting 10 seconds for requests to finish up instead of immediately exiting. As before, this can be configured with the `stop_timeout` server setting. (358)
* Logging for a misconfigured experiment is now done at INFO instead of WARNING to reduce logspam. (359)
* The `FileWatcher` now applies some configurable backoff to attempts to read the watched file during startup. This should reduce logspam during startup. (360)
* The SQLAlchemy `engine_from_config` implementation in Baseplate.py now supports the `pool_recycle` option. (365)

Upgrading

There should not be any breaking changes in this release.

If you want to upgrade, [see the documentation for how to move queue consumers to the new system](https://baseplate.readthedocs.io/en/v1.1.0/api/baseplate/frameworks/queue_consumer/deprecated.html#upgrading-to-a-queueconsumerserver).

Page 15 of 24

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.