Baseplate

Latest version: v2.6.0

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

Scan your dependencies

Page 11 of 24

2.2.0

New Features

Environment variable interpolation in configuration

It's now possible to reference environment variables in your INI configuration
files. This makes it possible to pull settings from your container's
environment while still remaining explicit in the configuration.

If you had an environment variable like `METRICS_HOST=telegraf`, then

ini
[app:main]

metrics.endpoint = ${METRICS_HOST}:8125


would appear to the application like you'd written `telegraf:8125` in the
config.

See 601.

Changes

* redis cluster: Allow configuration of more kinds of timeouts (605)
* sentry observer: Disable reporting of local variable values by default (607)
* meta: Add official support for Python 3.9 (609)
* baseplate-shell now writes out logs for auditing (610)
* event publisher sidecar: Swallow and log exceptions when publishing rather than crashing (also in 2.1.2, 611)
* tracing observer: Don't try to write oversized traces to message queue (613)
* event publisher sidecar: Allow publishing to non-TLS HTTP event collector proxies on private network (also in 2.1.2, 619)

Bug Fixes

* metrics: Fix config handling of `swallow_network_errors` setting (also in 2.1.1, 608)
* requests client: Add more private IP ranges to the allow-list (also in 2.1.2, 612)
* thrift pool: Fix type annotation on constructor's timeout parameter (also in 2.1.2, 618)

2.1.2

* Swallow and log exceptions in event_publisher sidecar (611)
* event publisher sidecar: allow http endpoint (619)
* Fix typing on thrift connection pool timeout parameter (618)
* InternalRequestsClient: allow more private IP ranges (612)

2.1.1

* Fix `metrics.swallow_network_errors` not being obeyed by metrics client (608)

2.1.0

This is a standard quarterly feature and bugfix release.

New Features

Redis Cluster Support

Baseplate.py now has an instrumented client for the [redis-py-cluster] library.
This allows your service to interact with redis in cluster mode.

For more information see [the documentation][cluster-docs] or 573.

[redis-py-cluster]: https://github.com/Grokzen/redis-py-cluster/
[cluster-docs]: https://baseplate.readthedocs.io/en/v2.1.0/api/baseplate/clients/redis_cluster.html

Deadline Budget Headers

If service A sets a time budget on calling service B and service B takes too
long, it's wasteful for service B to keep processing that request long after
service A has given up and stopped waiting for a response. To prevent this
waste, Baseplate.py will now send deadline budget headers automatically when
you specify a time budget on Thrift RPCs. Thrift servers will understand this
header and set their internal [server timeout] accordingly.

For example, the following call:

python
with context.service_b.retrying(attempts=3, budget=2) as svc:
svc.some_method()


Will retry the `some_method()` call up to 3 times as long as the total time
spent is less than 2 seconds (though note that the socket may block longer).
Each call to service B will carry information about how much time in the
budget remains, which will also be carried onto any services that service B
itself calls!

For more information, see 574 and 578.

[server timeout]: https://baseplate.readthedocs.io/en/v2.1.0/api/baseplate/observers/timeout.html

Changes

* Don't emit JSON logs to TTYs, this should be easier to read when running baseplate-serve directly. (also in v2.0.1, 584)
* Add runtime metrics for memcache pools. (586)
* Support SQLAlchemy 1.4 (also in v2.0.1, 587—please [read these notes before upgrading][sqlalchemy])
* Support publishing v2j batches in the event publisher sidecar. (also in v2.0.3, 590)
* Add a drain period to server shutdown. This allows the application to avoid getting routed traffic while shutting down. (591, 594)

Bug Fixes

* Add timeouts to HTTP calls made by secrets fetcher sidecar. (also in v2.0.2, 588)
* Fix metrics not being emitted from spans that were children of local spans (also in v2.0.3, 592)

Known Issues

* Returning an HTTPException subclass as a response in a Pyramid application may result in no body content being returned to the client. This bug was introduced in v1.5.0. See 575.

Upgrading

There should not be any breaking changes in this release. As always, use the [baseplate.py-upgrader](https://github.com/reddit/baseplate.py-upgrader) to get automatic upgrades and advice on things that need to be done manually.

If you want to reduce error rates during deploys, you can take advantage of the
drain period by making your healthcheck endpoint return a failure for
`READINESS` checks when the server is in the shutting down state. Here's an
example for an HTTP service:

diff
-1,6 +1,9
from baseplate.frameworks.pyramid import BaseplateRequest
from baseplate.frameworks.pyramid import get_is_healthy_probe
+from baseplate.server import SERVER_STATE
+from baseplate.server import ServerLifecycle
from baseplate.thrift.ttypes import IsHealthyProbe
+from pyramid.httpexceptions import HTTPServiceUnavailable
from pyramid.response import Response
from pyramid.view import view_config

-16,6 +19,9
return {}
elif probe_type == IsHealthyProbe.READINESS:
the readiness probe wants to know if we're ready to handle traffic.
+ if SERVER_STATE.state == ServerLifecycle.SHUTTING_DOWN:
+ raise HTTPServiceUnavailable(detail="no more please, I'm shutting down")
+
return {}
else: pragma: nocover
not sure what the future holds for us. let's play it safe.


[sqlalchemy]: https://docs.sqlalchemy.org/en/14/changelog/migration_14.html

2.0.3

* Support publishing v2j batches in the event publisher sidecar. (590)
* Add a drain period to server shutdown (591)
* Fix local span metrics observers registering child observers (592)

2.0.2

* Add timeouts to secrets fetcher HTTP requests to prevent sidecar from locking up (588)

Page 11 of 24

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.