Skip to content

Commit

Permalink
Merge branch 'userver-framework:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
RayeS2070 authored Nov 6, 2024
2 parents ab9db7a + 2eaa5e4 commit c06e0e8
Show file tree
Hide file tree
Showing 36 changed files with 119 additions and 52 deletions.
2 changes: 1 addition & 1 deletion core/include/userver/cache/caching_component_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace components {
///
/// @ref scripts/docs/en/userver/caches.md provide a more detailed introduction.
///
/// ## Dynamic config
/// ## CachingComponentBase Dynamic config
/// * @ref USERVER_CACHES
/// * @ref USERVER_DUMPS
///
Expand Down
2 changes: 1 addition & 1 deletion core/include/userver/cache/lru_cache_component_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ yaml_config::Schema GetLruCacheComponentBaseSchema();
/// Caching components must be configured in service config (see options below)
/// and may be reconfigured dynamically via components::DynamicConfig.
///
/// ## Dynamic config
/// ## LruCacheComponent Dynamic config
/// * @ref USERVER_LRU_CACHES
///
/// ## Static options:
Expand Down
2 changes: 1 addition & 1 deletion core/include/userver/components/logging_configurator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace components {
/// The functionality is not in Trace or Logger components because that
/// introduces circular dependency between Logger and DynamicConfig.
///
/// ## Dynamic config
/// ## LoggingConfigurator Dynamic config
/// * @ref USERVER_LOG_DYNAMIC_DEBUG
/// * @ref USERVER_NO_LOG_SPANS
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Manager;
/// @brief Component that prepares the engine internals and starts all the
/// other components.
///
/// ## Dynamic config
/// ## ManagerControllerComponent Dynamic config
/// * @ref USERVER_TASK_PROCESSOR_PROFILER_DEBUG
/// * @ref USERVER_TASK_PROCESSOR_QOS
///
Expand Down
2 changes: 1 addition & 1 deletion core/include/userver/congestion_control/component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace congestion_control {
///
/// @brief Component to limit too active requests, also known as CC.
///
/// ## Dynamic config
/// ## congestion_control::Component Dynamic config
/// * @ref USERVER_RPS_CCONTROL
/// * @ref USERVER_RPS_CCONTROL_ENABLED
///
Expand Down
2 changes: 1 addition & 1 deletion core/include/userver/dump/dumper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ enum class UpdateType {
///
/// Here, `dumper_name` is the name of the parent component.
///
/// ## Dynamic config
/// ## Dumper Dynamic config
/// * @ref USERVER_DUMPS
///
/// ## Static config
Expand Down
2 changes: 1 addition & 1 deletion core/include/userver/server/component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace components {
/// All the classes inherited from server::handlers::HttpHandlerBase and
/// registered in components list bind to the components::Server component.
///
/// ## Dynamic config
/// ## components::Server Dynamic config
/// * @ref USERVER_LOG_REQUEST
/// * @ref USERVER_LOG_REQUEST_HEADERS
/// * @ref USERVER_DEADLINE_PROPAGATION_ENABLED
Expand Down
2 changes: 1 addition & 1 deletion core/include/userver/server/handlers/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ enum class HandlerErrorCode {
kUnsupportedMediaType, //!< kUnsupportedMediaType Content-Encoding or
//!< Content-Type is not supported

// Server error codes are declared ater the client side error to be
// Server error codes are declared after the client side error to be
// mapped correctly to a protocol-specific error code!
};
// When adding enumerators here ^, please also add mappings to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace server::handlers {
/// @brief Handler that returns HTTP 200 if file exist
/// and returns file data with mapped content/type
///
/// ## Dynamic config
/// ## HttpHandlerStatic Dynamic config
/// * @ref USERVER_FILES_CONTENT_TYPE_MAP
///
/// \ref userver_http_handlers "Userver HTTP Handlers".
Expand Down
2 changes: 1 addition & 1 deletion core/include/userver/utils/statistics/busy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class BusyStorage final {
};

/// @brief A RAII-style guard to account code block execution time in
/// utils::statistics::BusyStorage. Aware of recursive invokations in the same
/// utils::statistics::BusyStorage. Aware of recursive invocations in the same
/// thread.
///
/// @snippet utils/statistics/busy_test.cpp busy sample
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/common_component_list_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@ TEST_F(ComponentList, ValidationWithConfigVars) {
)
);

constexpr const char* kBadParam = " non-described-in-schema-paramer: $default_log_path\n";
constexpr const char* kBadParam = " non-described-in-schema-parameter: $default_log_path\n";
const components::InMemoryConfig conf{std::string{kStaticConfig} + kBadParam + "config_vars: " + config_vars_path};

UEXPECT_THROW_MSG(
components::RunOnce(conf, components::CommonComponentList()),
std::exception,
"Error while validating static config against schema. Field "
"'components_manager.components.system-statistics-collector.non-described-in-schema-paramer' is not declared "
"'components_manager.components.system-statistics-collector.non-described-in-schema-parameter' is not declared "
"in schema 'system-statistics-collector' (declared: load-enabled, with-nginx, fs-task-processor)"
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class StandAloneCheckerTest : public ::testing::Test {
};

StandAloneCheckerTest()
: default_loader({temp_file_provier.GetFilePath(), storages::secdist::SecdistFormat::kJson, true, std::nullopt}
: default_loader({temp_file_provider.GetFilePath(), storages::secdist::SecdistFormat::kJson, true, std::nullopt}
),
secdist_config({&default_loader, std::chrono::milliseconds::zero()}),
digest_settings_({
Expand Down Expand Up @@ -86,7 +86,7 @@ class StandAloneCheckerTest : public ::testing::Test {
client_context_ = correct_client_context_;
}

TempFileProvider temp_file_provier;
TempFileProvider temp_file_provider;
storages::secdist::DefaultLoader default_loader;
storages::secdist::SecdistConfig secdist_config;

Expand Down
2 changes: 1 addition & 1 deletion grpc/include/userver/ugrpc/server/call.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <google/protobuf/message.h>
#include <grpcpp/server_context.h>

#include <userver/tracing/span.hpp>
#include <userver/ugrpc/impl/internal_tag_fwd.hpp>
#include <userver/ugrpc/impl/span.hpp>
#include <userver/ugrpc/impl/statistics_scope.hpp>
#include <userver/ugrpc/server/impl/call_params.hpp>
#include <userver/ugrpc/server/middlewares/fwd.hpp>
Expand Down
4 changes: 4 additions & 0 deletions grpc/include/userver/ugrpc/server/call_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <grpcpp/server_context.h>

#include <userver/tracing/span.hpp>
#include <userver/ugrpc/server/storage_context.hpp>
#include <userver/utils/any_storage.hpp>

Expand Down Expand Up @@ -33,6 +34,9 @@ class CallContext {
/// @brief Get name of called gRPC method
std::string_view GetMethodName() const;

/// @brief Get the span of the current RPC
tracing::Span& GetSpan();

/// @brief Returns call context for storing per-call custom data
///
/// The context can be used to pass data from server middleware to client
Expand Down
2 changes: 2 additions & 0 deletions grpc/include/userver/ugrpc/server/result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include <grpcpp/support/status.h>

#include <userver/utils/assert.hpp>

USERVER_NAMESPACE_BEGIN

namespace ugrpc::server {
Expand Down
1 change: 1 addition & 0 deletions grpc/include/userver/ugrpc/server/rpc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <userver/ugrpc/impl/deadline_timepoint.hpp>
#include <userver/ugrpc/impl/internal_tag_fwd.hpp>
#include <userver/ugrpc/impl/span.hpp>
#include <userver/ugrpc/server/call.hpp>
#include <userver/ugrpc/server/exceptions.hpp>
#include <userver/ugrpc/server/impl/async_methods.hpp>
Expand Down
2 changes: 2 additions & 0 deletions grpc/src/ugrpc/server/call_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ std::string_view CallContext::GetServiceName() const { return GetCall().GetServi

std::string_view CallContext::GetMethodName() const { return GetCall().GetMethodName(); }

tracing::Span& CallContext::GetSpan() { return GetCall().GetSpan(); }

utils::AnyStorage<StorageContext>& CallContext::GetStorageContext() { return GetCall().GetStorageContext(); }

const CallAnyBase& CallContext::GetCall() const { return call_; }
Expand Down
6 changes: 3 additions & 3 deletions kafka/src/kafka/impl/consumer_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ void ConsumerImpl::RevokePartitions(const rd_kafka_topic_partition_list_t* parti
return fmt::format("Partition {} of '{}' topic revoking", partition.partition, partition.topic);
});

const auto revokation_err = rd_kafka_assign(consumer_.GetHandle(), nullptr);
if (revokation_err != RD_KAFKA_RESP_ERR_NO_ERROR) {
LOG_ERROR() << fmt::format("Failed to revoke partitions: {}", rd_kafka_err2str(revokation_err));
const auto revocation_err = rd_kafka_assign(consumer_.GetHandle(), nullptr);
if (revocation_err != RD_KAFKA_RESP_ERR_NO_ERROR) {
LOG_ERROR() << fmt::format("Failed to revoke partitions: {}", rd_kafka_err2str(revocation_err));
return;
}

Expand Down
10 changes: 5 additions & 5 deletions kafka/src/kafka/impl/producer_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void ProducerImpl::WaitUntilDeliveryReported(engine::Future<DeliveryResult>& del
/// handle events from producer's queue.
///
/// Remark: events are created by `librdkafka` internal threads, so it is not
/// possible to atomically check queue emptyness and suspend the coroutine.
/// possible to atomically check queue emptiness and suspend the coroutine.

while (!delivery_result.is_ready() && !engine::current_task::ShouldCancel()) {
/// optimistic path. suppose that there are already some ready events from
Expand All @@ -291,17 +291,17 @@ void ProducerImpl::WaitUntilDeliveryReported(engine::Future<DeliveryResult>& del

EventWaiter waiter;
/// (N) notice that in any time after waiter is pushed into waiters list and
/// before it poped it may be waked up by EventCallback.
/// Consequently, after waiter is poped from the list, it must try to handle
/// before it popped it may be waked up by EventCallback.
/// Consequently, after waiter is popped from the list, it must try to handle
/// the events if it was signaled (event `delivery_result` is ready).
waiters_.PushWaiter(waiter);

/// If there are events, it is not neccessary to sleep.
/// If there are events, it is not necessary to sleep.
if (HandleEvents("after waiter created, before sleep")) {
waiters_.PopWaiter(waiter);
if (waiter.event.IsReady()) { // (N)
LOG_DEBUG() << "Waiter were signaled before sleeping!";
HandleEvents("after waiter poped, before sleep");
HandleEvents("after waiter popped, before sleep");
}
continue;
}
Expand Down
5 changes: 2 additions & 3 deletions kafka/src/kafka/impl/producer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ProducerImpl final {
void EventCallback();

private:
/// @brief Shedules the message delivery.
/// @brief Schedules the message delivery.
/// @returns the future for delivery result, which must be awaited.
[[nodiscard]] engine::Future<DeliveryResult> ScheduleMessageDelivery(
const std::string& topic_name,
Expand Down Expand Up @@ -91,8 +91,7 @@ class ProducerImpl final {
ConcurrentEventWaiters waiters_;
ProducerHolder producer_;

/// If no messages are send, some errors may occure and we want to log them
/// anyway.
/// If no messages are send, some errors may occurred and we want to log them anyway.
utils::PeriodicTask log_events_handler_;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

/// @file userver/s3api/authenticators/access_key.hpp
/// @brief Authenticator for using acess_key&secret_key for authentication
/// @brief Authenticator for using `access_key` and `secret_key` for authentication

#include <string>
#include <unordered_map>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

/// @file userver/s3api/authenticators/interface.hpp
/// @brief Interface for autheticators - classes that sign the request with auth data
/// @brief @copybrief s3api::authenticators::Authenticator

#include <memory>
#include <string>
Expand All @@ -15,7 +15,9 @@ struct Request;

namespace authenticators {

// This is base class for all authenticators
/// @ingroup userver_base_classes
///
/// @brief Base class for all authenticators - classes that sign the request with auth data
struct Authenticator {
virtual std::unordered_map<std::string, std::string> Auth(const Request& request) const = 0;
virtual std::unordered_map<std::string, std::string> Sign(const Request& request, time_t expires) const = 0;
Expand Down
2 changes: 2 additions & 0 deletions libraries/s3api/include/userver/s3api/clients/s3api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ std::shared_ptr<S3Connection> MakeS3Connection(
const ConnectionCfg& params
);

/// @ingroup userver_clients
///
/// Main interface for the S3 api
class Client {
public:
Expand Down
14 changes: 7 additions & 7 deletions mongo/src/storages/mongo/cdriver/pool_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,17 @@ stats::ConnStats& GetStats(void* stats_ptr) {
return *reinterpret_cast<stats::ConnStats*>(stats_ptr);
}

void CommandSuccessed(const mongoc_apm_command_succeeded_t* event) {
void CommandSucceeded(const mongoc_apm_command_succeeded_t* event) {
auto& stats = GetStats(mongoc_apm_command_succeeded_get_context(event));
stats.event_stats_.sucess += utils::statistics::Rate{1};
stats.event_stats_.success += utils::statistics::Rate{1};
}

void CommandFailed(const mongoc_apm_command_failed_t* event) {
auto& stats = GetStats(mongoc_apm_command_failed_get_context(event));
stats.event_stats_.failed += utils::statistics::Rate{1};
}

void HearbeatStarted(const mongoc_apm_server_heartbeat_started_t* event) {
void HeartbeatStarted(const mongoc_apm_server_heartbeat_started_t* event) {
auto& stats = GetStats(mongoc_apm_server_heartbeat_started_get_context(event));
++stats.apm_stats_->heartbeats.start;
LOG_LIMITED_DEBUG() << mongoc_apm_server_heartbeat_started_get_host(event)->host_and_port << " heartbeat started";
Expand All @@ -181,7 +181,7 @@ void HeartbeatSuccess(const mongoc_apm_server_heartbeat_succeeded_t* event) {
<< " heartbeat succeeded";
}

void HearbeatFailed(const mongoc_apm_server_heartbeat_failed_t* event) {
void HeartbeatFailed(const mongoc_apm_server_heartbeat_failed_t* event) {
auto& stats = GetStats(mongoc_apm_server_heartbeat_failed_get_context(event));
++stats.apm_stats_->heartbeats.failed;
LOG_LIMITED_WARNING() << mongoc_apm_server_heartbeat_failed_get_host(event)->host_and_port << " heartbeat failed";
Expand Down Expand Up @@ -475,11 +475,11 @@ CDriverPoolImpl::ConnPtr CDriverPoolImpl::Create() {
// Set command monitoring events to get command durations.
{
mongoc_apm_callbacks_t* cbs = mongoc_apm_callbacks_new();
mongoc_apm_set_command_succeeded_cb(cbs, CommandSuccessed);
mongoc_apm_set_command_succeeded_cb(cbs, CommandSucceeded);
mongoc_apm_set_command_failed_cb(cbs, CommandFailed);
mongoc_apm_set_server_heartbeat_started_cb(cbs, HearbeatStarted);
mongoc_apm_set_server_heartbeat_started_cb(cbs, HeartbeatStarted);
mongoc_apm_set_server_heartbeat_succeeded_cb(cbs, HeartbeatSuccess);
mongoc_apm_set_server_heartbeat_failed_cb(cbs, HearbeatFailed);
mongoc_apm_set_server_heartbeat_failed_cb(cbs, HeartbeatFailed);
mongoc_apm_set_topology_changed_cb(cbs, TopologyChanged);
mongoc_apm_set_topology_opening_cb(cbs, TopologyOpening);
mongoc_apm_set_topology_closed_cb(cbs, TopologyClosed);
Expand Down
4 changes: 2 additions & 2 deletions mongo/src/storages/mongo/stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ struct ApmStats final {
};

struct EventStats final {
Rate sucess;
Rate success;
Rate failed;

bool operator==(const EventStats& o) const { return sucess == o.sucess && failed == o.failed; }
bool operator==(const EventStats& o) const { return success == o.success && failed == o.failed; }
};

struct ConnStats final {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct EnumMappingBase {
};

/// An enumerators type that uses `Parse` and `ToString` functions for
/// convertions.
/// conversions.
struct Codegen {};

namespace detail {
Expand Down
2 changes: 1 addition & 1 deletion postgresql/src/storages/postgres/tests/chrono_pgtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ UTEST_P(PostgreConnection, ChronoTzConversions) {
INSERT INTO tz_conversion_sample(with_tz, without_tz) VALUES($1, $2)
RETURNING with_tz, without_tz
)";
// ERROR! Types missmatch and are implicitly converted:
// ERROR! Types mismatch and are implicitly converted:
// * TimePointWithoutTz is converted on the DB side and TZ substracted.
// * TimePointTz is converted on the DB side and TZ added.
const auto res = connection->Execute(kInsertQuery, pg::TimePointWithoutTz{now}, pg::TimePointTz{now});
Expand Down
2 changes: 1 addition & 1 deletion scripts/docs/en/userver/build/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ Alternatively see @ref userver_install
@anchor userver_conan
## Conan

@note conan must have version >= 1.51, but < 2.0
@note conan must have version >= 2.8

Thanks to Open-Source community we have Conan support.

Expand Down
6 changes: 3 additions & 3 deletions scripts/docs/en/userver/congestion_control.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ It is recommended to set this setting >= 2000 (2 ms) because system scheduler (C

## Diagnostics

In case RPS mechanism is triggered it is recommended to ensure that there is no mistake. If RPS triggering coinsided
with peak CPU comsumption than there is no mistake and the lack of resources situation needs to be resolved:
In case RPS mechanism is triggered it is recommended to ensure that there is no mistake. If RPS triggering coincided
with peak CPU consumption than there is no mistake and the lack of resources situation needs to be resolved:

1. You need to locate slow code and optimise it for the workload.

2. Do test runs and increase the resources if needed (more memory or more kernels for each pod in a cluster).

If RPS triggering did not coinside with peak CPU comsumption than there is no lack of resources but a different kind of problem.
If RPS triggering did not coincide with peak CPU consumption than there is no lack of resources but a different kind of problem.
Most likely your service has synchronous operations that block the coroutine flow. If this is the case then you need to either:

* Try to find synchronous system calls which block the corountine flow.
Expand Down
2 changes: 1 addition & 1 deletion scripts/docs/en/userver/development/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This development strategy provides fast delivery and adoption of new features.
## Releases and Release model

The above model may not fit if stability of interfaces is
required. Examples of such development cases are: making prebuilt packeges of
required. Examples of such development cases are: making prebuilt packages of
the framework for package managers or OS distros, release based development
model in the company, prototyping.

Expand Down
Loading

0 comments on commit c06e0e8

Please sign in to comment.