You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pdns/dnsdistdist/docs/reference/ottrace.rst
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,17 +141,20 @@ The following example makes :program:`dnsdist` accept a TRACEPARENT, and update
141
141
Creating Trace Spans from LuaActions
142
142
====================================
143
143
144
-
It is possible to create Spans inside :func:`LuaRules <LuaRule>` in order to track performance of your Lua code.
144
+
.. versionadded:: 2.2.0
145
+
146
+
It is possible to create Spans inside :func:`LuaRules <LuaRule>` or :func:`LuaResponseRules <LuaResponseRule>` in order to track performance of your Lua code.
145
147
To do this, you can call the :func:`DNSQuestion:withTraceSpan` function of the :class:`DNSQuestion` object.
146
-
This function takes a string that is the name of the Span and a function that accepts a single :class:`Closer` object.
148
+
This function takes a string that is the name of the Span and the function with will be instrumented.
147
149
148
150
.. code-block:: lua
149
151
150
152
function myLuaAction(dq)
153
+
dq:setSpanAttribute("attr-in-the-rule-span", "hello from Lua!")
151
154
dq:withTraceSpan(
152
155
'my-trace-span',
153
-
function (closer)
154
-
closer:setAttribute("some.key", "some-value")
156
+
function ()
157
+
dq:setSpanAttribute("some.key", "some-value")
155
158
-- Do some actual things with the DNSQuestion here
156
159
end
157
160
)
@@ -165,14 +168,14 @@ Within the function body, you can create more spans by calling :func:`DNSQuestio
165
168
function myLuaAction(dq)
166
169
dq:withTraceSpan(
167
170
'my-trace-span',
168
-
function (closer)
171
+
function ()
169
172
-- Some set up
170
-
closer:setAttribute("some.key", "some-value")
173
+
dq:setSpanAttribute("some.key", "some-value")
171
174
172
175
-- This will create a child span of 'my-trace-span'
173
176
dq:withTraceSpan(
174
177
'inner-span',
175
-
function (_) -- We're not using closer functions, so no need to assign it
0 commit comments