| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
jsonrpc: Wait for the socket to be ready to read. (#11815) jsonrpc: Add poll to wait for the socket to be ready to read. We found out that sometimes we hit a busy loop here, so adding a timeout to make sure we do not hangup forever here. | 1 年前 | |
JSONRPC - Use dynamic and configurable buffer for incoming jsonrpc messages.(#11763) | 1 年前 | |
Remove traffic_manager and related code. (#8633) * BREAKING: traffic_manager removal. Removing code related to: traffic_manager binary. records syncronization between TS running as client and TM running as server. deprecated functions, ie: mgmt_log legacy RPC mechanism, LocalManager, ProcessManager. Remove usage of traffic_manager from some unit tests. I had to make some adjustments to the way some of the tests "when" clauses were used. TS ready now uses the default “when” clause(FileContains) which is also checking the existence of the file, the latest is what was used in this test. TM removal: Remove some records used by TM and note in the docs that they are now deprecated. TM removal: Work the docs so they reflect that TM is no longer supported. This commit also includes some changes in the Records config file. TM Removal: Rename new traffic_ctl to the new folder(same as before). Ammend makefiles to just build the new version. TM: Removal. Merge mgmt2 and mgmt folders. Use the best from each folder and compile them into a single mgmt folder. mgmt2 was used to keep track of all new RPC code including things that can be reuse from the old mgmt folder, now with the clean up for the original folder we can just put the leftovers together. This also add some notes into some documentation. TM Removal: Remove Signal,Event and Alarms header files. This is a second part of the removal of the code related to events and alarms. TM Removal: remove Admin perl module. TM removal: Fix doc issues and missing include. Fix build issue Fix not literal string issue * Update unit test after merge from master: Use traffic_server instead of traffic_manager. * Mark legacy records as deprecated * Fix bsd build crash: Add include for unordered_map * Fix trafficserver.ext: Fix rebase issue, it looks like I was missing the ts args from the command line. Fixed now. | 4 年前 | |
Expose JSON client timeout to CLI (#12323) * Expose JSON client timeout to CLI * Make default timeout much larger | 1 年前 | |
Add hidden metrics and MAX/MIN/incremental derived metric aggregation (#13505) * tsutil: make the Metrics unit tests order independent The tests asserted absolute metric ids and iterator positions, which only hold when the case runs first against an otherwise empty store. Any other test case that creates a published metric makes them fail. Assert on relative state instead so the cases can run in any order. * tsutil: add a separate storage for hidden metrics Hidden metrics are stored but never published. Using a separate Storage instance rather than a per-metric flag makes them structurally unreachable from the published store, so no metric consumer can expose them by omission. Gauge and Counter each gain createHiddenPtr overloads which return the same correctly typed pointer as createPtr, so a hidden metric is read and written with the normal typed mutators and no cast is needed at the call site. * tsutil: fail gracefully when metric storage is exhausted Storage::create() had no exhaustion check, so filling the last blob let the following bookkeeping call addBlob() and write one past the end of _blobs. Refuse the final slot instead and return the reserved bad_id, which keeps addBlob() from ever being reached in a full store and costs one slot out of 8M. The guard in addBlob() was also off by one against the access it protects, since the write is to _blobs[++_cur_blob], and being a debug_assert it was compiled out of release builds entirely. Make it a release_assert against MAX_BLOBS - 1. * traffic_ctl: add --include-hidden to metric match Hidden metrics are invisible to normal queries by design, which makes them hard to debug. Add an opt-in rec type bit, deliberately outside RECT_ALL so hidden metrics are never returned unless explicitly requested. The rec type also has to be accepted by the JSONRPC request decoder, which validates each requested type against a whitelist and rejects the whole request otherwise. No wire or schema change is needed, as rec_types is already an untyped list of ints. * tsutil: support MAX and MIN aggregation for derived metrics Derived metrics could only sum their sources. Add an op to the spec so a derived metric can also take the max or min across its sources, which is what an aggregate over instantaneous gauges needs. The accumulator is seeded from the first source rather than from zero, since a zero seed is only correct for SUM and would clamp MIN to <= 0. op defaults to SUM, so existing specs are unaffected. * tsutil: skip derived metric sources that do not resolve A source given by name or id that does not resolve was still passed to lookup(), which masks the unresolved id down to the reserved bad_id slot. The aggregate then silently included that slot's value instead of skipping the source, with no error reported. Resolve each source first and skip it if it does not resolve. This is observable under MAX and MIN, where the bad_id value can become the winning one; under SUM it happened to be hidden by bad_id holding zero. * tsutil: allow adding derived metric sources at runtime derive() only accepts a fixed initializer_list, which does not work for aggregates whose sources are discovered as the process runs. Calling it repeatedly for one derived name does not help either: it appends a separate entry per call, all targeting the same metric, so each update overwrites the others with its own subset and the last writer silently wins. add_source() accumulates sources into a single entry instead. Registering a source that is already present is a no-op, so a caller that may re-register the same source need not track that itself. * doc: document hidden and derived metrics Add a developer guide page for the metrics registry covering the hidden store, how it differs from the published one and why it is a separate store rather than a flag, and the derived metric aggregation ops including when derived values are recomputed and what that means for a sampled maximum. * Tag hidden metrics with RECT_HIDDEN_METRIC as well as RECT_PROCESS The record lookup callback rejects any record whose rec_type shares no bit with the requested mask, so tagging hidden metrics RECT_PROCESS alone made a request for only RECT_HIDDEN_METRIC fail with REQUESTED_TYPE_MISMATCH. Now that the request decoder accepts that type on its own, such a request is expressible, so set both bits. Add a unit test covering the hidden-only and include-hidden requests and confirming RECT_ALL still excludes them. * Value-initialize the synthetic records in the record lookups Both lookup functions build a RecRecord on the stack for metrics, which live outside the g_records array, and hand it to the caller's callback. The JSONRPC encoder reads version, registered, rsb_id, order and data_default unconditionally, so leaving them indeterminate lets a --format json metric query emit different values on successive runs, and reading an indeterminate bool is undefined behavior. Five sites, all with the same one word fix. Only the hidden metric loop is new in this branch; the rest have had the pattern for years. * Grow a new blob when a span ends on the blob boundary createSpan checked whether a span fit before reserving it but never re-checked afterwards, so a span ending exactly on MAX_SIZE left the offset at MAX_SIZE with no new blob allocated. The next create() then wrote one past the end of that blob's name array, and end() became an id that iterator::next() can never reach, since it wraps at ++offset == MAX_SIZE. create() has always grown as soon as it consumed the last slot; do the same here. Also refuse a span that would fill or overflow the final blob, so the new growth cannot ask addBlob() to go past the last one and trip its assert. createSpan(MAX_SIZE) always starts a fresh blob and fills it exactly, whatever the current offset, so the added test reaches the boundary deterministically. It fails without the fix. * Polish the --include-hidden surface Three small corrections to the flag added earlier in this branch: Skip slot 0 when walking the hidden store. Every Storage reserves it for the bad_id placeholder, so it exists under the same name in both stores and a query matching it returned two records differing only in value, in exactly the debugging situation the flag is for. Scope the option to 'match' with a nested program directive. As a bare option under 'traffic_ctl metric' it rendered as a peer of get, match and describe, so it read as another subcommand rather than a flag on match. This follows the 'config get --records' pattern earlier in the file. Put the flag before the positional in the CLI example usage so it agrees with that synopsis, which is also the convention the rest of the file uses. | 19 天前 | |
ATS Configuration Reload with observability/tracing - Token model (#12892) ATS Configuration Reload with observability/tracing — Token model Replace the fire-and-forget configuration reload mechanism with a new token-based, observable reload framework. Every reload operation is now assigned a unique token, tracked through a task tree, and queryable via CLI or JSONRPC at any point after submission. Core components introduced: - ConfigRegistry: centralized singleton for config file registration, filename records, trigger records, and reload handlers. Replaces the scattered registration across AddConfigFilesHere.cc and individual modules. - ReloadCoordinator: manages reload session lifecycle including token generation, concurrency control (--force to override), timeout detection, and rolling history. - ConfigReloadTask: tracks a single reload as a tree of sub-tasks with per-handler status, timings, and logs. - ConfigContext: lightweight context passed to handlers providing in_progress(), complete(), fail(), log(), supplied_yaml(), and add_dependent_ctx(). Safe no-op at startup when no reload is active. - ConfigReloadProgress: periodic checker that detects stuck tasks and marks them as TIMEOUT. New traffic_ctl commands: - config reload [-m] [-t <token>] [-d @file] [--force] - config status [-t <token>] [-c all] All commands support --format json for automation and CI pipelines. New JSONRPC APIs: - admin_config_reload: unified file-based or inline reload with token, force, and configs parameters. - get_reload_config_status: query reload status by token or get the last N reloads. Migrated config handlers to ConfigRegistry: ip_allow, cache_control, cache_hosting, parent_proxy, split_dns, remap, logging, ssl_client_coordinator (with sni.yaml and ssl_multicert.config as dependencies), ssl_ticket_key, records, and pre-warm. Static configs (storage, volume, plugin, socks, jsonrpc) registered as inventory-only. Removed legacy ConfigUpdateHandler/ConfigUpdateContinuation from ConfigProcessor.h. Removed AddConfigFilesHere.cc in favor of per-module self-registration. Fixed duplicate handler execution for configs with multiple trigger records (e.g. ssl_client_coordinator) by deduplicating against the ConfigReloadTask subtask tree. Added RecFlushConfigUpdateCbs() to synchronously fire pending record callbacks after rereadConfig(), ensuring all subtasks are registered before the first status poll. New configuration records: - proxy.config.admin.reload.timeout (default: 1h) - proxy.config.admin.reload.check_interval (default: 2s) Backward compatible: existing `traffic_ctl config reload` works as before; internally it now uses the new framework with automatic token assignment and tracking. | 5 个月前 |
JSONRPC 2.0 Client API utility definitions.
All this definitions are meant to be used by clients of the JSONRPC node which
are looking to interact with it in a different C++ application, like traffic_ctl
and traffic_top.
All this definitions under the shared::rpc namespace are a client lightweight
version of the ones used internally by the JSONRPC node server/handlers, they
should not be mixed with the ones defined in mgmt/rpc/jsonrpc which are for
internal use only.