Copilot commented on code in PR #13274:
URL: https://github.com/apache/trafficserver/pull/13274#discussion_r3416329810
##########
plugins/compress/compress.cc:
##########
@@ -349,6 +349,21 @@ compress_transform_init(TSCont contp, Data *data)
TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
}
+// CPU-model driver for the compress plugin (its CPU lands in the generic
'plugin' bucket): total
+// uncompressed input bytes fed to the codec, the near-linear driver of
deflate/gzip/brotli CPU.
+// compress dispatches via TSTransformCreate (not PluginVC), so the core
per-plugin byte counter
+// never sees it. Created once at plugin init.
+static int compress_stat_bytes_in = TS_ERROR;
+
+static void
+init_compress_stats()
+{
+ if (TS_ERROR == compress_stat_bytes_in) {
+ compress_stat_bytes_in =
+ TSStatCreate("proxy.process.plugin.compress.bytes_in",
TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_COUNT);
+ }
+}
Review Comment:
Stat initialization uses TSStatCreate() unconditionally with
TS_RECORDDATATYPE_INT / TS_STAT_SYNC_COUNT and doesn’t attempt TSStatFindName()
first. If the stat already exists (e.g., plugin loaded twice via different
paths), TSStatCreate can fail and leave compress_stat_bytes_in as TS_ERROR, so
the hot-path increment becomes a no-op. Also, bytes should be registered as a
COUNTER with SYNC_SUM to match its semantics.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]