Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builtin-functions/kphp-light/stdlib/error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ class Random\RandomException extends Exception {}

// === UNSUPPORTED ===

/** @kphp-extern-func-info stub generation-required */
/** @kphp-extern-func-info stub */
function kphp_backtrace($pretty ::: bool = true) ::: string[];
2 changes: 1 addition & 1 deletion builtin-functions/kphp-light/stdlib/kphp-toggles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function set_migration_php8_warning ($mask ::: int) ::: void;

// === UNSUPPORTED ===

/** @kphp-extern-func-info stub generation-required */
/** @kphp-extern-func-info stub */
function kphp_turn_on_host_tag_in_inner_statshouse_metrics_toggle() ::: void;

function set_json_log_on_timeout_mode(bool $enabled) ::: void;
Expand Down
53 changes: 40 additions & 13 deletions builtin-functions/kphp-light/stdlib/kphp-tracing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,101 @@
// ===== UNSUPPORTED =====

final class KphpDiv {
/** @kphp-extern-func-info stub generation-required */
/** @kphp-extern-func-info stub */
private function __construct();

/** @kphp-extern-func-info stub */
function generateTraceCtxForChild(int $div_id, int $trace_flags): tuple(int, int);

/** @kphp-extern-func-info stub */
function assignTraceCtx(int $int1, int $int2, ?int $override_div_id): int;

/** @kphp-extern-func-info stub generation-required */
/** @kphp-extern-func-info stub */
function getStartTimestamp(): float;

/** @kphp-extern-func-info stub generation-required */
/** @kphp-extern-func-info stub */
function getEndTimestamp(): float;
}

final class KphpSpan {
/** @kphp-extern-func-info stub */
private function __construct();

/** @kphp-extern-func-info stub */
function addAttributeString(string $key, string $value) ::: void;

/** @kphp-extern-func-info stub */
function addAttributeInt(string $key, int $value) ::: void;
/** @kphp-extern-func-info stub generation-required */

/** @kphp-extern-func-info stub */
function addAttributeFloat(string $key, float $value) ::: void;
/** @kphp-extern-func-info stub generation-required */

/** @kphp-extern-func-info stub */
function addAttributeBool(string $key, bool $value) ::: void;
/** @kphp-extern-func-info stub generation-required */

/** @kphp-extern-func-info stub */
function addAttributeEnum(string $key, int $enum_id, int $value) ::: void;

/** @kphp-extern-func-info stub */
function addEvent(string $name, ?float $timestamp = null): KphpSpanEvent;
/** @kphp-extern-func-info stub generation-required */
function addLink(KphpSpan $another) ::: void;

/** @kphp-extern-func-info stub */
function addLink(KphpSpan $another) ::: void;

/** @kphp-extern-func-info stub */
function updateName(string $title, string $short_desc) ::: void;

/** @kphp-extern-func-info stub */
function finish(?float $end_timestamp = null) ::: void;

/** @kphp-extern-func-info stub */
function finishWithError(int $error_code, string $error_msg, ?float $end_timestamp = null) ::: void;
/** @kphp-extern-func-info stub generation-required */

/** @kphp-extern-func-info stub */
function exclude() ::: void;
}

final class KphpSpanEvent {
/** @kphp-extern-func-info stub */
private function __construct();

/** @kphp-extern-func-info stub generation-required */
/** @kphp-extern-func-info stub */
function addAttributeString(string $key, string $value) ::: void;
/** @kphp-extern-func-info stub generation-required */

/** @kphp-extern-func-info stub */
function addAttributeInt(string $key, int $value) ::: void;
/** @kphp-extern-func-info stub generation-required */

/** @kphp-extern-func-info stub */
function addAttributeFloat(string $key, float $value) ::: void;
/** @kphp-extern-func-info stub generation-required */

/** @kphp-extern-func-info stub */
function addAttributeBool(string $key, bool $value) ::: void;
}

/** @kphp-extern-func-info stub */
function kphp_tracing_init(string $root_span_title): KphpDiv;

/** @kphp-extern-func-info stub */
function kphp_tracing_set_level(int $trace_level): void;

/** @kphp-extern-func-info stub */
function kphp_tracing_get_level(): int;

/** @kphp-extern-func-info stub */
function kphp_tracing_register_on_finish(callable(float $now_timestamp):bool $cb_should_be_flushed);
/** @kphp-extern-func-info stub */
function kphp_tracing_register_enums_provider(callable():tuple(int, string, string[])[] $cb_custom_enums);
/** @kphp-extern-func-info stub */
function kphp_tracing_register_rpc_details_provider(callable(@tl\RpcFunction):string $cb_for_typed, callable(mixed):string $cb_for_untyped);

/** @kphp-extern-func-info stub */
function kphp_tracing_start_span(string $title, string $short_desc, float $start_timestamp): KphpSpan;

/** @kphp-extern-func-info stub */
function kphp_tracing_get_root_span(): KphpSpan;

/** @kphp-extern-func-info stub */
function kphp_tracing_get_current_active_span(): KphpSpan;

/** @kphp-extern-func-info stub */
function kphp_tracing_func_enter_branch(int $branch_num) ::: void;
4 changes: 4 additions & 0 deletions runtime-light/stdlib/diagnostics/error-handling-functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ inline array<array<string>> f$debug_backtrace() noexcept {
return {};
}

inline array<string> f$kphp_backtrace([[maybe_unused]] bool pretty = true) noexcept {
return {};
}

inline int64_t f$error_reporting(Optional<int64_t> new_error_level_opt = {}) noexcept {
auto& error_handling_st{ErrorHandlingState::get()};
const int64_t current_error_level{error_handling_st.minimum_log_level};
Expand Down
2 changes: 2 additions & 0 deletions runtime-light/stdlib/system/system-functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,5 @@ inline string f$get_kphp_cluster_name() noexcept {
kphp::log::warning("called stub get_kphp_cluster_name");
return string{"adm512"};
}

inline void f$kphp_turn_on_host_tag_in_inner_statshouse_metrics_toggle() noexcept {}
13 changes: 11 additions & 2 deletions runtime-light/stdlib/tracing/tracing-div.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@

struct C$KphpDiv : public refcountable_php_classes<C$KphpDiv>, private DummyVisitorMethods {
using DummyVisitorMethods::accept;

C$KphpDiv() noexcept = default;
};

inline int64_t f$KphpDiv$$assignTraceCtx([[maybe_unused]] const class_instance<C$KphpDiv>& v$this, [[maybe_unused]] int64_t int1, [[maybe_unused]] int64_t int2,
[[maybe_unused]] const Optional<int64_t>& override_div_id) {
kphp::log::info("called stub KphpDiv::assignTraceCtx");

return {};
}

inline std::tuple<int64_t, int64_t> f$KphpDiv$$generateTraceCtxForChild([[maybe_unused]] const class_instance<C$KphpDiv>& v$this,
[[maybe_unused]] int64_t div_id, [[maybe_unused]] int64_t trace_flags) {
kphp::log::info("called stub KphpDiv::generateTraceCtxForChild");
return {};
}

inline double f$KphpDiv$$getStartTimestamp([[maybe_unused]] const class_instance<C$KphpDiv>& v$this) noexcept {
return {};
}

inline double f$KphpDiv$$getEndTimestamp([[maybe_unused]] const class_instance<C$KphpDiv>& v$this) noexcept {
return {};
}
11 changes: 11 additions & 0 deletions runtime-light/stdlib/tracing/tracing-event.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ struct C$KphpSpanEvent : public refcountable_php_classes<C$KphpSpanEvent> {
explicit C$KphpSpanEvent(int32_t span_id) noexcept
: span_id(span_id) {}
};

inline void f$KphpSpanEvent$$addAttributeString([[maybe_unused]] const string& value) noexcept {}

inline void f$KphpSpanEvent$$addAttributeInt([[maybe_unused]] const class_instance<C$KphpSpanEvent>& v$this, [[maybe_unused]] const string& key,
[[maybe_unused]] int64_t value) noexcept {}

inline void f$KphpSpanEvent$$addAttributeFloat([[maybe_unused]] const class_instance<C$KphpSpanEvent>& v$this, [[maybe_unused]] const string& key,
[[maybe_unused]] double value) noexcept {}

inline void f$KphpSpanEvent$$addAttributeBool([[maybe_unused]] const class_instance<C$KphpSpanEvent>& v$this, [[maybe_unused]] const string& key,
[[maybe_unused]] bool value) noexcept {}
25 changes: 5 additions & 20 deletions runtime-light/stdlib/tracing/tracing-functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,35 @@
#include "runtime-light/stdlib/tracing/tracing-span.h"

inline class_instance<C$KphpSpan> f$kphp_tracing_get_current_active_span() noexcept {
kphp::log::info("called stub kphp_tracing_get_current_active_span");
return {};
}

inline void f$kphp_tracing_func_enter_branch(int /*$branch_num*/) noexcept {
kphp::log::info("called stub kphp_tracing_func_enter_branch");
}
inline void f$kphp_tracing_func_enter_branch(int64_t /*$branch_num*/) noexcept {}

inline class_instance<C$KphpSpan> f$kphp_tracing_get_root_span() noexcept {
kphp::log::info("called stub kphp_tracing_get_root_span");
return {};
}

inline class_instance<C$KphpDiv> f$kphp_tracing_init([[maybe_unused]] const string& root_span_title) noexcept {
kphp::log::info("called stub kphp_tracing_init");
return {};
}

inline int64_t f$kphp_tracing_get_level() {
kphp::log::info("called stub kphp_tracing_get_level");
return -1; // Not initialized
}

inline class_instance<C$KphpSpan> f$kphp_tracing_start_span([[maybe_unused]] const string& title, [[maybe_unused]] const string& short_desc,
[[maybe_unused]] double start_timestamp) noexcept {
kphp::log::info("called stub kphp_tracing_start_span");
return {};
}

template<typename F>
void f$kphp_tracing_register_enums_provider([[maybe_unused]] F&& cb_custom_enums) noexcept {
kphp::log::info("called stub kphp_tracing_register_enums_provider");
}
void f$kphp_tracing_register_enums_provider([[maybe_unused]] F&& cb_custom_enums) noexcept {}

template<typename F>
void f$kphp_tracing_register_on_finish([[maybe_unused]] F&& cb_should_be_flushed) noexcept {
kphp::log::info("called stub kphp_tracing_register_on_finish");
}
void f$kphp_tracing_register_on_finish([[maybe_unused]] F&& cb_should_be_flushed) noexcept {}

template<typename F1, typename F2>
void f$kphp_tracing_register_rpc_details_provider([[maybe_unused]] F1&& cb_for_typed, [[maybe_unused]] F2&& cb_for_untyped) noexcept {
kphp::log::info("called stub kphp_tracing_register_rpc_details_provider");
}
void f$kphp_tracing_register_rpc_details_provider([[maybe_unused]] F1&& cb_for_typed, [[maybe_unused]] F2&& cb_for_untyped) noexcept {}

inline void f$kphp_tracing_set_level([[maybe_unused]] int64_t trace_level) noexcept {
kphp::log::info("called stub kphp_tracing_set_level");
}
inline void f$kphp_tracing_set_level([[maybe_unused]] int64_t trace_level) noexcept {}
39 changes: 21 additions & 18 deletions runtime-light/stdlib/tracing/tracing-span.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,36 @@ struct C$KphpSpan : public refcountable_php_classes<C$KphpSpan>, private DummyVi
: span_id(span_id) {}
};

inline void f$KphpSpan$$addAttributeString([[maybe_unused]] const class_instance<C$KphpSpan>& v$this, [[maybe_unused]] const string& key,
[[maybe_unused]] const string& value) noexcept {}

inline void f$KphpSpan$$addAttributeInt([[maybe_unused]] const class_instance<C$KphpSpan>& v$this, [[maybe_unused]] const string& key,
[[maybe_unused]] int64_t value) noexcept {
kphp::log::info("called stub KphpSpan::addAttributeInt");
}
[[maybe_unused]] int64_t value) noexcept {}

inline void f$KphpSpan$$addAttributeString([[maybe_unused]] const class_instance<C$KphpSpan>& v$this, [[maybe_unused]] const string& key,
[[maybe_unused]] const string& value) noexcept {
kphp::log::info("called stub KphpSpan::addAttributeString");
}
inline void f$KphpSpan$$addAttributeFloat([[maybe_unused]] const class_instance<C$KphpSpan>& v$this, [[maybe_unused]] const string& key,
[[maybe_unused]] double value) noexcept {}

inline void f$KphpSpan$$addAttributeBool([[maybe_unused]] const class_instance<C$KphpSpan>& v$this, [[maybe_unused]] const string& key,
[[maybe_unused]] bool value) noexcept {}

inline void f$KphpSpan$$addAttributeEnum([[maybe_unused]] const class_instance<C$KphpSpan>& v$this, [[maybe_unused]] const string& key,
[[maybe_unused]] int64_t enum_id, [[maybe_unused]] int64_t value) noexcept {}

inline class_instance<C$KphpSpanEvent> f$KphpSpan$$addEvent([[maybe_unused]] const class_instance<C$KphpSpan>& v$this, [[maybe_unused]] const string& name,
[[maybe_unused]] const Optional<double>& manual_timestamp = {}) noexcept {
kphp::log::info("called stub KphpSpan::addEvent");
return {};
}

inline void f$KphpSpan$$finish([[maybe_unused]] const class_instance<C$KphpSpan>& v$this,
[[maybe_unused]] const Optional<double>& manual_timestamp = {}) noexcept {
kphp::log::info("called stub KphpSpan::finish");
}
inline void f$KphpSpan$$addLink([[maybe_unused]] const class_instance<C$KphpSpan>& v$this,
[[maybe_unused]] const class_instance<C$KphpSpan>& another) noexcept {}

inline void f$KphpSpan$$updateName([[maybe_unused]] const class_instance<C$KphpSpan>& v$this, [[maybe_unused]] const string& title,
[[maybe_unused]] const string& short_desc) noexcept {
kphp::log::info("called stub KphpSpan::updateName");
}
[[maybe_unused]] const string& short_desc) noexcept {}

inline void f$KphpSpan$$finish([[maybe_unused]] const class_instance<C$KphpSpan>& v$this,
[[maybe_unused]] const Optional<double>& manual_timestamp = {}) noexcept {}

inline void f$KphpSpan$$finishWithError([[maybe_unused]] const class_instance<C$KphpSpan>& v$this, [[maybe_unused]] int64_t error_code,
[[maybe_unused]] const string& error_msg, [[maybe_unused]] const Optional<float>& manual_timestamp = {}) {
kphp::log::info("called stub KphpSpan::finishWithError");
}
[[maybe_unused]] const string& error_msg, [[maybe_unused]] const Optional<float>& manual_timestamp = {}) {}

inline void f$KphpSpan$$exclude([[maybe_unused]] const class_instance<C$KphpSpan>& v$this) noexcept {}
Loading