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
@@ -143,17 +143,20 @@ The following example makes :program:`dnsdist` accept a TRACEPARENT, and update
143
143
Creating Trace Spans from LuaActions
144
144
====================================
145
145
146
-
It is possible to create Spans inside :func:`LuaRules <LuaRule>` in order to track performance of your Lua code.
146
+
.. versionadded:: 2.2.0
147
+
148
+
It is possible to create Spans inside :func:`LuaRules <LuaRule>` or :func:`LuaResponseRules <LuaResponseRule>` in order to track performance of your Lua code.
147
149
To do this, you can call the :func:`DNSQuestion:withTraceSpan` function of the :class:`DNSQuestion` object.
148
-
This function takes a string that is the name of the Span and a function that accepts a single :class:`Closer` object.
150
+
This function takes a string that is the name of the Span and the function with will be instrumented.
149
151
150
152
.. code-block:: lua
151
153
152
154
function myLuaAction(dq)
155
+
dq:setSpanAttribute("attr-in-the-rule-span", "hello from Lua!")
153
156
dq:withTraceSpan(
154
157
'my-trace-span',
155
-
function (closer)
156
-
closer:setAttribute("some.key", "some-value")
158
+
function ()
159
+
dq:setSpanAttribute("some.key", "some-value")
157
160
-- Do some actual things with the DNSQuestion here
158
161
end
159
162
)
@@ -167,14 +170,14 @@ Within the function body, you can create more spans by calling :func:`DNSQuestio
167
170
function myLuaAction(dq)
168
171
dq:withTraceSpan(
169
172
'my-trace-span',
170
-
function (closer)
173
+
function ()
171
174
-- Some set up
172
-
closer:setAttribute("some.key", "some-value")
175
+
dq:setSpanAttribute("some.key", "some-value")
173
176
174
177
-- This will create a child span of 'my-trace-span'
175
178
dq:withTraceSpan(
176
179
'inner-span',
177
-
function (_) -- We're not using closer functions, so no need to assign it
0 commit comments