[
https://issues.apache.org/jira/browse/TS-2150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14597922#comment-14597922
]
ASF GitHub Bot commented on TS-2150:
------------------------------------
Github user SolidWallOfCode commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/229#discussion_r33062665
--- Diff: proxy/logging/LogField.cc ---
@@ -212,6 +269,51 @@ LogField::~LogField()
ats_free(m_symbol);
}
+TransactionMilestones::Milestone
+LogField::milestone_from_m_name(const char *m_name)
+{
+ milestone_map::iterator it;
+ TransactionMilestones::Milestone result =
TransactionMilestones::LAST_ENTRY;
+
+ it = m_milestone_map.find(m_name);
+ if (it != m_milestone_map.end())
+ result = it->second;
+
+ return result;
+}
+
+int
+LogField::milestones_from_m_name(const char *m_name,
TransactionMilestones::Milestone *ms1, TransactionMilestones::Milestone *ms2)
+{
+ milestone_map::iterator it;
+ char *ms_name;
+ size_t ms_name_len, skip;
+
+ ms_name_len = strcspn(m_name, " -");
+ ms_name = strndup(m_name, ms_name_len);
--- End diff --
It's very frowned upon to do allocations in the main path. The find method
should be changed to accept a `char const*` and length and avoid the
duplication / allocation here.
> Add Milestone log tags
> ----------------------
>
> Key: TS-2150
> URL: https://issues.apache.org/jira/browse/TS-2150
> Project: Traffic Server
> Issue Type: New Feature
> Components: Logging
> Reporter: Leif Hedstrom
> Assignee: John Rushford
> Fix For: sometime
>
>
> We have a notion of milestones in the core, and plugin APIs
> (TSHttpTxnMilestoneGet() ). It'd be useful to expose these milestone timers
> as a log tag, something like:
> {code}
> %<{UA_BEGIN}mtms>
> {code}
> mtms is just an example / suggestion, "MilestoneTimeMilliSecond", we can make
> it whatever we like.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)