You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "ywkaras (via GitHub)" <gi...@apache.org> on 2023/09/08 20:07:11 UTC
[GitHub] [trafficserver] ywkaras opened a new pull request, #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
ywkaras opened a new pull request, #10390:
URL: https://github.com/apache/trafficserver/pull/10390
Replace with Dbg() and DbgCtl::on(). This required extensive changes to the ESI plugin unit tests.
Doc changes were also necessary.
The redirect_1 example plugin is changed to illustrate how to implement debug trace output in a plugin that can compile and run with either these ATS10 changes or for older versions of ATS.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] cmcfarlen commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1329483619
##########
plugins/cache_promote/policy.h:
##########
@@ -28,6 +28,10 @@ extern int TXN_ARG_IDX;
#define MAX_STAT_LENGTH (1 << 8)
extern const char *PLUGIN_NAME;
+extern DbgCtl cache_promote_dbg_ctl;
+
+#define DBG(...) Dbg(cache_promote_dbg_ctl, __VA_ARGS__)
Review Comment:
Why is this plugin converted with a macro rather than `Dbg`?
##########
doc/developer-guide/api/functions/TSTrafficServerVersionGet.en.rst:
##########
@@ -55,6 +55,8 @@ Example
#define PLUGIN_NAME "hello_world"
+ DbgCtl dbg_ctl{PLUGIN_NAME};
Review Comment:
Do you want to establish the convention of putting these in anonymous namespaces here?
##########
example/plugins/c-api/protocol/Protocol.h:
##########
@@ -36,6 +36,12 @@
#define PLUGIN_NAME "protocol"
+namespace protocol_ns
+{
+extern DbgCtl dbg_ctl;
+}
+using namespace protocol_ns;
Review Comment:
I know this is just an example, but putting this `using namespace` in a header might lead to user astonishment.
##########
plugins/esi/esi.cc:
##########
@@ -139,6 +154,7 @@ struct ContData {
input_type(DATA_TYPE_RAW_ESI),
packed_node_list(""),
gzipped_data(""),
+ dbg_ctl{createDebugTag(DEBUG_TAG, contptr)},
Review Comment:
Won't this insert a lot of tags into the registry? How often is `ContData` instantiated?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1330441503
##########
doc/developer-guide/api/functions/TSTrafficServerVersionGet.en.rst:
##########
@@ -55,6 +55,8 @@ Example
#define PLUGIN_NAME "hello_world"
+ DbgCtl dbg_ctl{PLUGIN_NAME};
Review Comment:
I think it's not that simple. If I add an anonymous namespace, `check_ts_version()` probably belongs in it also. But, if I make such changes consistently, in all the files I'm touching, it will likely double the size of this PR. I get a lot of surprising push back in reviews on this project. For example, push back that seems to dispute the value of RAII. Which makes me feel like adding any sort of cleanup risks adding further delay to merging PRs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras commented on pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#issuecomment-1718090947
@cmcfarlen this is passing CI now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1330701909
##########
plugins/esi/esi.cc:
##########
@@ -139,6 +154,7 @@ struct ContData {
input_type(DATA_TYPE_RAW_ESI),
packed_node_list(""),
gzipped_data(""),
+ dbg_ctl{createDebugTag(DEBUG_TAG, contptr)},
Review Comment:
But my changes don't increase the number of instances of ContData. I see the issue, but what can I do about it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] cmcfarlen commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1330784160
##########
plugins/esi/esi.cc:
##########
@@ -139,6 +154,7 @@ struct ContData {
input_type(DATA_TYPE_RAW_ESI),
packed_node_list(""),
gzipped_data(""),
+ dbg_ctl{createDebugTag(DEBUG_TAG, contptr)},
Review Comment:
It seems like these tags are generated to add correlation context to the log statements and not as a way to filter them with the tagging mechanism. One idea would be to move this context from the tag name into the log message and have a fixed number of dbgctl tags.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1330446083
##########
example/plugins/c-api/protocol/Protocol.h:
##########
@@ -36,6 +36,12 @@
#define PLUGIN_NAME "protocol"
+namespace protocol_ns
+{
+extern DbgCtl dbg_ctl;
+}
+using namespace protocol_ns;
Review Comment:
I see your point, but what do you see as the better alternative?
TS developers must steel themselves to endure astonishment, and not in a good way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1330539768
##########
plugins/esi/esi.cc:
##########
@@ -139,6 +154,7 @@ struct ContData {
input_type(DATA_TYPE_RAW_ESI),
packed_node_list(""),
gzipped_data(""),
+ dbg_ctl{createDebugTag(DEBUG_TAG, contptr)},
Review Comment:
If you create multiple DbgCtl instances for the same tag, they will all point to the same entry in the registry map. In any case, I think each instance of this continuation class will have a unique debug tag. So there's a net increase, per class instance, of 8 bytes for the pointer in the DbgCtl, plus the overhead of an additional std::map entry.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1331888406
##########
plugins/esi/esi.cc:
##########
@@ -139,6 +154,7 @@ struct ContData {
input_type(DATA_TYPE_RAW_ESI),
packed_node_list(""),
gzipped_data(""),
+ dbg_ctl{createDebugTag(DEBUG_TAG, contptr)},
Review Comment:
OK, valid point.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras commented on pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#issuecomment-1724722204
@cmcfarlen It's successfully rebased.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] cmcfarlen commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1330686876
##########
plugins/esi/esi.cc:
##########
@@ -139,6 +154,7 @@ struct ContData {
input_type(DATA_TYPE_RAW_ESI),
packed_node_list(""),
gzipped_data(""),
+ dbg_ctl{createDebugTag(DEBUG_TAG, contptr)},
Review Comment:
It looks like a new ContData instance is created per transaction that this plugin handles. Since the tag is created using the address of the `contptr` instance, I feel like there is a good chance that there will be a lot of additional tags due to this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] cmcfarlen commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1330683972
##########
doc/developer-guide/api/functions/TSTrafficServerVersionGet.en.rst:
##########
@@ -55,6 +55,8 @@ Example
#define PLUGIN_NAME "hello_world"
+ DbgCtl dbg_ctl{PLUGIN_NAME};
Review Comment:
I just mean in this example, since folks tend to copy pasta examples. If we want to prefer anonymous namespaces, having that in the example will help with proliferation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras merged pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras merged PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1330526641
##########
plugins/cache_promote/policy.h:
##########
@@ -28,6 +28,10 @@ extern int TXN_ARG_IDX;
#define MAX_STAT_LENGTH (1 << 8)
extern const char *PLUGIN_NAME;
+extern DbgCtl cache_promote_dbg_ctl;
+
+#define DBG(...) Dbg(cache_promote_dbg_ctl, __VA_ARGS__)
Review Comment:
I think I did this before I thought of the other approach with `using namespace`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] cmcfarlen commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1331821084
##########
plugins/esi/esi.cc:
##########
@@ -139,6 +154,7 @@ struct ContData {
input_type(DATA_TYPE_RAW_ESI),
packed_node_list(""),
gzipped_data(""),
+ dbg_ctl{createDebugTag(DEBUG_TAG, contptr)},
Review Comment:
Correct me if I am wrong, but as I understand it, any tags created by DbgCtl instances will only be cleaned up when the Registry destructor is called. The DbgCtl destructor only decrements the reference counter. Therefore, if some code (i.e. this very esi plugin), creates a new DbgCtl instance per ATS transaction, the size of the tag registry will grow unbounded.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1333293743
##########
plugins/esi/esi.cc:
##########
@@ -139,6 +154,7 @@ struct ContData {
input_type(DATA_TYPE_RAW_ESI),
packed_node_list(""),
gzipped_data(""),
+ dbg_ctl{createDebugTag(DEBUG_TAG, contptr)},
Review Comment:
Fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficserver] ywkaras commented on a diff in pull request #10390: Remove TSDebug() and TSIsDebugTagSet() TS API functions.
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10390:
URL: https://github.com/apache/trafficserver/pull/10390#discussion_r1331775204
##########
plugins/esi/esi.cc:
##########
@@ -139,6 +154,7 @@ struct ContData {
input_type(DATA_TYPE_RAW_ESI),
packed_node_list(""),
gzipped_data(""),
+ dbg_ctl{createDebugTag(DEBUG_TAG, contptr)},
Review Comment:
But does that really belong in *this* PR? The change you suggest would reduce memory use in the existing code. It can't clearly be claimed it's addressing an issue that I created.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org