Class: Quark::MdkTracing::Tracer

Inherits:
DatawireQuarkCore::QuarkObject show all
Extended by:
DatawireQuarkCore::Static
Defined in:
lib/mdk_tracing.rb

Overview

Send log messages to the MCP server.

Constant Summary

Constants included from DatawireQuarkCore::Static

DatawireQuarkCore::Static::Unassigned

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DatawireQuarkCore::Static

_lazy_statics, static, unlazy_statics

Methods inherited from DatawireQuarkCore::QuarkObject

#to_s

Constructor Details

#initialize(runtime, wsclient) ⇒ Tracer

Returns a new instance of Tracer.



174
175
176
177
178
179
180
181
# File 'lib/mdk_tracing.rb', line 174

def initialize(runtime, wsclient)
    
    self.__init_fields__
    (self).runtime = runtime
    (self)._client = ::Quark.mdk_tracing.protocol.TracingClient.new(self, wsclient)

    nil
end

Instance Attribute Details

#_clientObject

Returns the value of attribute _client.



167
168
169
# File 'lib/mdk_tracing.rb', line 167

def _client
  @_client
end

#lastPollObject

Returns the value of attribute lastPoll.



167
168
169
# File 'lib/mdk_tracing.rb', line 167

def lastPoll
  @lastPoll
end

#loggerObject

Returns the value of attribute logger.



167
168
169
# File 'lib/mdk_tracing.rb', line 167

def logger
  @logger
end

#runtimeObject

Returns the value of attribute runtime.



167
168
169
# File 'lib/mdk_tracing.rb', line 167

def runtime
  @runtime
end

Class Method Details

.withURLAndToken(url, token) ⇒ Object



196
197
198
199
200
201
202
203
204
205
206
# File 'lib/mdk_tracing.rb', line 196

def self.withURLAndToken(url, token)
    
    runtime = ::Quark.mdk_runtime.defaultRuntime()
    wsclient = ::Quark.mdk_protocol.WSClient.new(runtime, ::Quark.mdk_rtp.getRTPParser(), url, token)
    (runtime).dispatcher.startActor(wsclient)
    newTracer = ::Quark.mdk_tracing.Tracer.new(runtime, wsclient)
    (runtime).dispatcher.startActor(newTracer)
    return newTracer

    nil
end

.withURLsAndToken(url, queryURL, token) ⇒ Object

Backwards compatibility.



189
190
191
192
193
194
# File 'lib/mdk_tracing.rb', line 189

def self.withURLsAndToken(url, queryURL, token)
    
    return ::Quark.mdk_tracing.Tracer.withURLAndToken(url, token)

    nil
end

Instance Method Details

#__init_fields__Object



291
292
293
294
295
296
297
298
299
# File 'lib/mdk_tracing.rb', line 291

def __init_fields__()
    
    self.logger = ::Quark.quark._getLogger("MDK Tracer")
    self.lastPoll = 0
    self._client = nil
    self.runtime = nil

    nil
end

#_getClassObject



247
248
249
250
251
252
# File 'lib/mdk_tracing.rb', line 247

def _getClass()
    
    return "mdk_tracing.Tracer"

    nil
end

#_getField(name) ⇒ Object



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/mdk_tracing.rb', line 254

def _getField(name)
    
    if ((name) == ("logger"))
        return (self).logger
    end
    if ((name) == ("lastPoll"))
        return (self).lastPoll
    end
    if ((name) == ("_client"))
        return (self)._client
    end
    if ((name) == ("runtime"))
        return (self).runtime
    end
    return nil

    nil
end

#_setField(name, value) ⇒ Object



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/mdk_tracing.rb', line 273

def _setField(name, value)
    
    if ((name) == ("logger"))
        (self).logger = value
    end
    if ((name) == ("lastPoll"))
        (self).lastPoll = ::DatawireQuarkCore.cast(value) { ::Integer }
    end
    if ((name) == ("_client"))
        (self)._client = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_tracing.protocol.TracingClient }
    end
    if ((name) == ("runtime"))
        (self).runtime = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_runtime.MDKRuntime }
    end

    nil
end

#log(event) ⇒ Object

Send a log message to the server.



232
233
234
235
236
237
238
# File 'lib/mdk_tracing.rb', line 232

def log(event)
    
    @logger.trace(("CTX ") + ((event).context.toString()))
    @_client.log(event)

    nil
end

#onMessage(origin, mesage) ⇒ Object



222
223
224
225
226
227
# File 'lib/mdk_tracing.rb', line 222

def onMessage(origin, mesage)
    
    nil

    nil
end

#onStart(dispatcher) ⇒ Object



208
209
210
211
212
213
# File 'lib/mdk_tracing.rb', line 208

def onStart(dispatcher)
    
    dispatcher.startActor(@_client)

    nil
end

#onStopObject



215
216
217
218
219
220
# File 'lib/mdk_tracing.rb', line 215

def onStop()
    
    (@runtime).dispatcher.stopActor(@_client)

    nil
end

#subscribe(handler) ⇒ Object



240
241
242
243
244
245
# File 'lib/mdk_tracing.rb', line 240

def subscribe(handler)
    
    @_client.subscribe(handler)

    nil
end