Skip to content

Commit

Permalink
feat docs: add changelog for March 2024
Browse files Browse the repository at this point in the history
Tests: протестировано локально и в CI
9be7181b472d5c699e564b5a42f833f1e5095f38
  • Loading branch information
apolukhin committed Mar 31, 2024
1 parent 354b36e commit 2389bbf
Show file tree
Hide file tree
Showing 16 changed files with 111 additions and 17 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Kulikov Vasily <[email protected]>
Lazarev Alexander <[email protected]>
Malkov Alexander <[email protected]>
Polukhin Antony <[email protected]>
Rudenko Arkady <[email protected]>
Sudakov Dmitrii <[email protected]>
Trofimov Ivan <[email protected]>
Vatulin Aleksandr <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async def test_timeout_expired(
deadline,
attempts,
):
async with service_client.capture_logs() as capture:
async with service_client.capture_logs(log_level='INFO') as capture:
async with client_metrics:
response = await call(
headers={DP_TIMEOUT_MS: str(deadline)},
Expand Down Expand Up @@ -147,7 +147,7 @@ async def test_deadline_expired(
deadline,
attempts,
):
async with service_client.capture_logs() as capture:
async with service_client.capture_logs(log_level='INFO') as capture:
async with client_metrics:
response = await call(
headers={DP_TIMEOUT_MS: str(deadline)},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class Hasher final {
public:
/// Constructor from the hash algorithm name from "crypto" namespace
/// to be used for hashing and storages::secdist::SecdistConfig containing a
/// server secret key to be used for "nonce" generating.
/// server secret key `http_server_digest_auth_secret`
/// to be used for "nonce" generating.
Hasher(std::string_view algorithm, const SecdistConfig& secdist_config);

/// Returns "nonce" directive value in hexadecimal format.
Expand Down
2 changes: 1 addition & 1 deletion grpc/include/userver/ugrpc/client/impl/async_methods.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class RpcData final {
// FinishAsyncMethodInvocation that will correctly close all our
// tracing::Span objects and account everything in statistics.
// In stream response, we use AsyncMethodInvocation for every intermediate
// Read* call, because we don't need to close span and/or accout stats
// Read* call, because we don't need to close span and/or account stats
// when finishing Read* call.
std::variant<std::monostate, AsyncMethodInvocation,
FinishAsyncMethodInvocation>
Expand Down
2 changes: 1 addition & 1 deletion grpc/tests/src/wait_any_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AsyncTestService final : public sample::ugrpc::UnitTestServiceBase {
// here, we have lock
// drop flag back
answers_count_--;
// lock is droped automatically upon exiting this scope
// lock is dropped automatically upon exiting this scope
}

if (!wait_result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ mongo.pool.conn-closed: mongo_database=key-value-database RATE 0
# Number of connections created since the service start
mongo.pool.conn-created: mongo_database=key-value-database RATE 2

# Connection initilization errors since the service start
# Connection initialization errors since the service start
mongo.pool.conn-init.errors-total: mongo_database=key-value-database, mongo_error=total RATE 0

# Connection initilization successes since the service start
# Connection initialization successes since the service start
mongo.pool.conn-init.success: mongo_database=key-value-database RATE 2

# Connection initialization timings
Expand Down
1 change: 1 addition & 0 deletions samples/testsuite-support/src/testpoint.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "testpoint.hpp"

/// [Testpoint - include]

#include <userver/testsuite/testpoint.hpp>
/// [Testpoint - include]

Expand Down
1 change: 1 addition & 0 deletions samples/testsuite-support/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# /// [testsuite - pytest_plugins]
# Adding a plugin from userver/testsuite/pytest_plugins/
pytest_plugins = ['pytest_userver.plugins.core']
# /// [testsuite - pytest_plugins]
2 changes: 1 addition & 1 deletion samples/testsuite-support/tests/test_logcapture.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# /// [select]
async def test_select(service_client):
async with service_client.capture_logs() as capture:
async with service_client.capture_logs(log_level='INFO') as capture:
response = await service_client.get('/logcapture')
assert response.status == 200

Expand Down
2 changes: 2 additions & 0 deletions scripts/docs/en/userver/functional_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ Accessing testpoint userver is not aware of will raise an exception:
* C++ code: @ref samples/testsuite-support/src/testpoint.cpp
* Testcase: @ref samples/testsuite-support/tests/test_testpoint.py

@anchor testsuite_logs_capture
#### Logs capture

Testsuite can be used to test logs written by service.
Expand All @@ -369,6 +370,7 @@ Example on logs capture usage could be found here:
* C++ code: @ref samples/testsuite-support/src/logcapture.cpp
* Testcase: @ref samples/testsuite-support/tests/test_logcapture.py


@anchor TESTSUITE_TASKS
#### Testsuite tasks

Expand Down
68 changes: 64 additions & 4 deletions scripts/docs/en/userver/roadmap_and_changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Changelog news also go to the
* ✓ LISTEN/NOTIFY support for PostgreSQL
* ✓ New landing page for the website
* ✓ Significantly reduce network data transmission for PostgreSQL
* Implement middlewares for HTTP server.
* Move most of the HTTP server functionality to middlewares.
* Document middlewares/plugins for HTTP client.
* ✓ Support `install` in CMake.
* ✓ Implement middlewares for HTTP server.
* ✓ Move most of the HTTP server functionality to middlewares.
* ✓ Document middlewares/plugins for HTTP client.
* Codegen parsers and serializers by JSON schema
* Support `install` in CMake.
* Add YDB driver.
* Add retry budget or retry circuit breaker for clients.
* Add web interface to the [uservice-dynconf](https://github.com/userver-framework/uservice-dynconf)
Expand All @@ -34,6 +34,66 @@ Changelog news also go to the

## Changelog

### March 2024

* Installation via `cmake --install` was implemented. See @ref userver_install
for more info.
* Implemented @ref scripts/docs/en/userver/http_server_middlewares.md
* @ref USERVER_LOG_DYNAMIC_DEBUG now provides fine granted runtime control over
logging.
* Now all the modern versions of `libmongoc` are supported in `userver-mongo`.
* @ref POSTGRES_CONNLIMIT_MODE_AUTO_ENABLED is now `on` by default.
* A secret value for the digest nonce generating now could be provided in
`http_server_digest_auth_secret` key via components::Secdist. Many thanks to
[Mingaripov Niyaz](https://github.com/mnink275) for the PR!
* ugrpc::server::ServerComponent now has a `unix-socket-path` static option to
listen on unix domain socket path instead of an inet socket.
* All the `formats::*::ValueBuilder` now support std::string_view. Thanks to
Андрей Будиловский for the bug report!
* clients::http::Form is now movable and slightly more efficient. Thanks to
[Alexandr Kondratev](https://github.com/theg4sh) for the PR!
* Redis now supports `SSUBSCRIBE` and removes dead nodes.
* engine::WaitAny() now can wait for an engine::io::Socket/engine::io::TlsWrapper
to become readable or writable. For example:
`engine::WaitAny(socket.GetReadableBase(), task1, tls_socket.GetWritableBase(), future1);`
* New tracing::Span::MakeRootSpan() helper function.

* Optimizations:
* Switched from unmaintained `http_parser` to a 156% faster `llhttp`.
* Implemented a concurrent::StripedCounter that allows to have a per-cpu data
in user space with kernel-provided transactional guarantees. Works
at least x2 faster than std::atomic on a single thread and scales
linearly (unlike std::atomic). As a result gives more than x10 performance
improvement under heavy contention.
* An explicit control over cache invalidations in testsuite. As a result,
less caches are invalidated between tests and the overall time to run tests
goes down significantly.
* Components start was optimized to copy less containers during component
dependencies detection.
* Per each incoming HTTP request:
* one less `std::chrono::steady_clock::now()` call
* one less `StrCaseHash` construction (2 calls into `std::uniform_int_distribution<std::uint64_t>` over `std::mt19937`)
* one less `dynamic_config::Snapshot` construction (at least one atomic CAS)
* HTTP Clients now copies less std::shared_ptr`s in implementation.
* Optimized up to an order of magnitude the user types query in PostgreSQL
driver.
* pytest_userver.client.Client.capture_logs() now accepts `log_level` to
filter out messages with lower log level in the service itself and minimize
CPU and memory consumption during tests.
* Up to two times faster utils::statistics::RecentPeriod statistics in
PostgreSQL driver due to switching to a utils::datetime::SteadyCoarseClock.

* Build:
* Workarounds for the Protobuf >= 5.26.0
* Removed redundant semicolon, thanks to Oleksii Demchenko for the
[PR](https://github.com/userver-framework/userver/commit/b3abb84d6bb1da693).
* utils::FastScopeGuard now uses proper traits. Thanks to
[Илья Оплачкин](https://github.com/IoplachkinI) for the PR and to
[Artyom Kolpakov](https://github.com/ddvamp) for the report!
* Added missing dependency for Arch based distros. Thanks to
[VScdr](https://github.com/VS-CDR) for the PR!


### February 2024

* PostgreSQL driver now keeps processing the current queries and transactions
Expand Down
2 changes: 1 addition & 1 deletion scripts/docs/en/userver/tutorial/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ find_package(userver REQUIRED COMPONENTS core postgresql grpc redis clickhouse m
in your `CMakeLists.txt`. Choose only the necessary components.
@see @ref userver_libraries

Finaly, link your source with userver component.
Finally, link your source with userver component.

For instance:
```
Expand Down
1 change: 1 addition & 0 deletions testsuite/SetupUserverTestsuiteEnv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# It is not used for testing services based on userver.

# /// [testsuite - UserverTestsuite]
# cmake
include(UserverTestsuite)
# /// [testsuite - UserverTestsuite]

Expand Down
16 changes: 14 additions & 2 deletions testsuite/pytest_plugins/pytest_userver/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,9 +1142,21 @@ def list_tasks(self) -> typing.List[str]:
def spawn_task(self, name: str):
return self._client.spawn_task(name)

def capture_logs(self, *, testsuite_skip_prepare: bool = False):
def capture_logs(
self,
*,
log_level: str = 'DEBUG',
testsuite_skip_prepare: bool = False,
):
"""
Captures logs from the service.
@param log_level Do not capture logs below this level.
@see @ref testsuite_logs_capture
"""
return self._client.capture_logs(
testsuite_skip_prepare=testsuite_skip_prepare,
log_level=log_level, testsuite_skip_prepare=testsuite_skip_prepare,
)

@_wrap_client_error
Expand Down
17 changes: 15 additions & 2 deletions testsuite/pytest_plugins/pytest_userver/plugins/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,25 @@ def patch_config(config, config_vars):


@pytest.fixture(scope='session')
def userver_default_log_level():
def userver_default_log_level() -> str:
"""
Default log level to use in userver if no caoomand line option was provided.
Returns 'debug'.
@ingroup userver_testsuite_fixtures
"""
return 'debug'


@pytest.fixture(scope='session')
def userver_log_level(pytestconfig, userver_default_log_level):
def userver_log_level(pytestconfig, userver_default_log_level) -> str:
"""
Returns --service-log-level value if provided, otherwise returns
userver_default_log_level() value from fixture.
@ingroup userver_testsuite_fixtures
"""
if pytestconfig.option.service_log_level:
return pytestconfig.option.service_log_level
return userver_default_log_level
Expand Down
2 changes: 2 additions & 0 deletions universal/include/userver/utils/default_dict.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ namespace impl {

} // namespace impl

/// @ingroup userver_universal userver_containers
///
/// @brief Dictionary that for missing keys falls back to a default value
/// stored by key utils::kDefaultDictDefaultName.
///
Expand Down

0 comments on commit 2389bbf

Please sign in to comment.