@@ -18,13 +18,27 @@ internal unsafe class CEventTrace
1818 * Data for an event. This is a collection of key-value pairs (fields). Use EventData* functions to
1919 * read or write fields.
2020 */
21- public class EventData : CptrHandle
21+ public class EventDataHandle : CptrHandle
2222 {
23+ public EventDataHandle ( )
24+ {
25+ }
26+
27+ internal EventDataHandle ( IntPtr handle )
28+ {
29+ SetHandle ( handle ) ;
30+ }
31+
2332 protected override bool ReleaseHandle ( )
2433 {
2534 EventDataDestroy ( handle ) ;
2635 return true ;
2736 }
37+
38+ internal IntPtr GetUnderlying ( )
39+ {
40+ return handle ;
41+ }
2842 }
2943
3044 public class EventTracer : CptrHandle
@@ -100,7 +114,7 @@ public struct Span
100114 */
101115 [ DllImport ( Constants . WorkerLibrary , CallingConvention = CallingConvention . Cdecl ,
102116 EntryPoint = "Trace_EventData_Create" ) ]
103- public static extern EventData EventDataCreate ( ) ;
117+ public static extern EventDataHandle EventDataCreate ( ) ;
104118
105119 /** Frees resources for the event data object.*/
106120 [ DllImport ( Constants . WorkerLibrary , CallingConvention = CallingConvention . Cdecl ,
@@ -113,12 +127,12 @@ public struct Span
113127 */
114128 [ DllImport ( Constants . WorkerLibrary , CallingConvention = CallingConvention . Cdecl ,
115129 EntryPoint = "Trace_EventData_AddStringFields" ) ]
116- public static extern void EventDataAddStringFields ( EventData data , Uint32 count , Char * * keys , Char * * values ) ;
130+ public static extern void EventDataAddStringFields ( EventDataHandle data , Uint32 count , Char * * keys , Char * * values ) ;
117131
118132 /** Returns the number of fields on the given event data object. */
119133 [ DllImport ( Constants . WorkerLibrary , CallingConvention = CallingConvention . Cdecl ,
120134 EntryPoint = "Trace_EventData_GetFieldCount" ) ]
121- public static extern Uint32 EventDataGetFieldCount ( EventData data ) ;
135+ public static extern Uint32 EventDataGetFieldCount ( EventDataHandle data ) ;
122136
123137 /**
124138 * Returns all the key value pairs in the event data object. keys and values must have capacity for
@@ -128,12 +142,12 @@ public struct Span
128142 */
129143 [ DllImport ( Constants . WorkerLibrary , CallingConvention = CallingConvention . Cdecl ,
130144 EntryPoint = "Trace_EventData_GetStringFields" ) ]
131- public static extern void EventDataGetStringFields ( EventData data , Char * * keys , Char * * values ) ;
145+ public static extern void EventDataGetStringFields ( EventDataHandle data , Char * * keys , Char * * values ) ;
132146
133147 /** Returns the value for the given key. */
134148 [ DllImport ( Constants . WorkerLibrary , CallingConvention = CallingConvention . Cdecl ,
135149 EntryPoint = "Trace_EventData_GetFieldValue" ) ]
136- public static extern Char * EventDataGetFieldValue ( EventData data , Char * key ) ;
150+ public static extern Char * EventDataGetFieldValue ( EventDataHandle data , Char * key ) ;
137151
138152 /** Data for an event added to the event-tracer. */
139153 [ StructLayout ( LayoutKind . Sequential ) ]
@@ -153,7 +167,7 @@ public struct Event
153167 public struct Item
154168 {
155169 /** The type of the item, defined using ItemType. */
156- public Uint8 ItemType ;
170+ public ItemType ItemType ;
157171
158172 /** An item can either be a Span or an Event. */
159173 public Union ItemUnion ;
@@ -187,12 +201,12 @@ public struct EventTracerParameters
187201
188202 /** Creates an event-tracer. */
189203 [ DllImport ( Constants . WorkerLibrary , CallingConvention = CallingConvention . Cdecl ,
190- EntryPoint = "EventTracerCreate " ) ]
204+ EntryPoint = "Trace_EventTracer_Create " ) ]
191205 public static extern EventTracer EventTracerCreate ( EventTracerParameters * parameters ) ;
192206
193207 /** Frees resources for an event-tracer. */
194208 [ DllImport ( Constants . WorkerLibrary , CallingConvention = CallingConvention . Cdecl ,
195- EntryPoint = "EventTracerDestroy " ) ]
209+ EntryPoint = "Trace_EventTracer_Destroy " ) ]
196210 public static extern void EventTracerDestroy ( IntPtr eventTracer ) ;
197211
198212 /**
@@ -234,8 +248,8 @@ public struct EventTracerParameters
234248 * EventTracerGetActiveSpanId will return a null span ID.
235249 */
236250 [ DllImport ( Constants . WorkerLibrary , CallingConvention = CallingConvention . Cdecl ,
237- EntryPoint = "Trace_EventTracer_UnsetActiveSpanId " ) ]
238- public static extern void EventTracerUnsetActiveSpanId ( EventTracer eventTracer ) ;
251+ EntryPoint = "Trace_EventTracer_ClearActiveSpanId " ) ]
252+ public static extern void EventTracerClearActiveSpanId ( EventTracer eventTracer ) ;
239253
240254 /** Gets the active span ID on the event-tracer. */
241255 [ DllImport ( Constants . WorkerLibrary , CallingConvention = CallingConvention . Cdecl ,
@@ -272,7 +286,7 @@ public struct EventTracerParameters
272286 * The item is initialized by copying the provided item; pass a NULL item argument to create an
273287 * item in an uninitialized state.
274288 *
275- * Directly creating a TraceItem object (on the stack or the heap) by other means than calling this
289+ * Directly creating a Item object (on the stack or the heap) by other means than calling this
276290 * method is discouraged as it will lead to undefined behaviour when passing that item to certain
277291 * trace API methods (e.g. SerializeItemToStream).
278292 */
0 commit comments