mirror of https://github.com/grpc/grpc.git
parent
40e578d330
commit
b3e061e086
8 changed files with 188 additions and 0 deletions
@ -0,0 +1,13 @@ |
||||
// Copyright 2024 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
@ -0,0 +1,18 @@ |
||||
// Copyright 2024 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H |
||||
#define GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H |
||||
|
||||
#endif // GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H
|
@ -0,0 +1,56 @@ |
||||
// Copyright 2024 gRPC authors. |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
// |
||||
// Automatically generated by tools/codegen/core/gen_trace_flags.py |
||||
// |
||||
|
||||
#include "${absl_prefix}absl/container/flat_hash_map.h" |
||||
|
||||
#include "src/core/lib/debug/trace.h" |
||||
#include "src/core/lib/gprpp/no_destruct.h" |
||||
|
||||
namespace grpc_core { |
||||
|
||||
% for flag, settings in trace_flags.items(): |
||||
% if "debug_only" in settings and settings["debug_only"]: |
||||
DebugOnlyTraceFlag ${flag}_trace(${str(settings["default"]).lower()}, "${flag}"); |
||||
% endif |
||||
% endfor |
||||
% for flag, settings in trace_flags.items(): |
||||
% if "debug_only" not in settings or not settings["debug_only"]: |
||||
TraceFlag ${flag}_trace(${str(settings["default"]).lower()}, "${flag}"); |
||||
% endif |
||||
% endfor |
||||
|
||||
const absl::flat_hash_map<std::string, TraceFlag*>& GetAllTraceFlags() { |
||||
static const NoDestruct<absl::flat_hash_map<std::string, TraceFlag*>> |
||||
all(absl::flat_hash_map<std::string, TraceFlag*>({ |
||||
% for flag, settings in trace_flags.items(): |
||||
% if "debug_only" not in settings or not settings["debug_only"]: |
||||
{"${flag}", &${flag}_trace}, |
||||
% endif |
||||
% endfor |
||||
#ifndef NDEBUG |
||||
% for flag, settings in trace_flags.items(): |
||||
% if "debug_only" in settings and settings["debug_only"]: |
||||
{"${flag}", &${flag}_trace}, |
||||
% endif |
||||
% endfor |
||||
#endif |
||||
})); |
||||
return *all; |
||||
} |
||||
|
||||
} // namespace grpc_core |
@ -0,0 +1,40 @@ |
||||
// Copyright 2015 gRPC authors. |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
// |
||||
// Automatically generated by tools/codegen/core/gen_trace_flags.py |
||||
// |
||||
|
||||
#ifndef GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H |
||||
#define GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H |
||||
|
||||
#include "src/core/lib/debug/trace_impl.h" |
||||
|
||||
|
||||
namespace grpc_core { |
||||
|
||||
% for flag, settings in trace_flags.items(): |
||||
% if "debug_only" in settings and settings["debug_only"]: |
||||
extern DebugOnlyTraceFlag ${flag}_trace; |
||||
% endif |
||||
% endfor |
||||
% for flag, settings in trace_flags.items(): |
||||
% if not "debug_only" in settings or not settings["debug_only"]: |
||||
extern TraceFlag ${flag}_trace; |
||||
% endif |
||||
% endfor |
||||
|
||||
} // namespace grpc_core |
||||
|
||||
#endif // GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H |
@ -0,0 +1,48 @@ |
||||
<!--- |
||||
Automatically generated by tools/codegen/core/gen_trace_flags.py |
||||
---> |
||||
|
||||
gRPC Trace Flags |
||||
---------------- |
||||
|
||||
The `GRPC_TRACE` environment variable supports a comma-separated list of tracer |
||||
names or glob patterns that provide additional insight into how gRPC C core is |
||||
processing requests via debug logs. Available tracers include: |
||||
|
||||
% for flag, settings in trace_flags.items(): |
||||
% if "internal" in settings and settings["internal"]: |
||||
<% continue %> |
||||
% endif |
||||
% if "debug_only" not in settings or not settings["debug_only"]: |
||||
% if settings["description"]: |
||||
- ${flag} - ${settings["description"]} |
||||
% else: |
||||
- ${flag} |
||||
% endif |
||||
% endif |
||||
% endfor |
||||
|
||||
The following tracers will only run in binaries built in DEBUG mode. This is |
||||
accomplished by invoking `bazel build --config=dbg <target>` |
||||
% for flag, settings in trace_flags.items(): |
||||
% if "internal" in settings and settings["internal"]: |
||||
<% continue %> |
||||
% endif |
||||
% if "debug_only" in settings and settings["debug_only"]: |
||||
% if settings["description"]: |
||||
- ${flag} - ${settings["description"]} |
||||
% else: |
||||
- ${flag} |
||||
% endif |
||||
% endif |
||||
% endfor |
||||
|
||||
Glob patterns and special cases: |
||||
- `*` can be used to turn all traces on. |
||||
- Individual traces can be disabled by prefixing them with `-`. |
||||
- `*refcount*` will turn on all of the tracers for refcount debugging. |
||||
- if `list_tracers` is present, then all of the available tracers will be |
||||
printed when the program starts up. |
||||
|
||||
Example: |
||||
export GRPC_TRACE=*,-pending_tags |
Loading…
Reference in new issue