jaegertracing / jaeger-client-csharp

🛑 This library is DEPRECATED!
https://jaegertracing.io/
Apache License 2.0
303 stars 67 forks source link

tracking manual object #188

Closed EngRajabi closed 3 years ago

EngRajabi commented 4 years ago

It is possible that cases where the socket class is made manually. Tracking done?

Falco20019 commented 4 years ago

Hi, I sadly did not understand your use case. Can you explain it in more detail? How is the class manual, where is the socket connected to?

EngRajabi commented 4 years ago

If the programmer uses the socket class and send and receive a series of data. Not shown in tracking like

private void BeginSend()
{
    _clientState = EClientState.Sending;
    byte[] buffer = GetSomeData(); // gives you data for the buffer

    SocketAsyncEventArgs e = new SocketAsyncEventArgs();
    e.SetBuffer(buffer, 0, buffer.Length);
    e.Completed += new EventHandler<SocketAsyncEventArgs>(SendCallback);

    bool completedAsync = false;

    try
    {
        completedAsync = _socket.SendAsync(e);
    }
    catch (SocketException se)
    {
        Console.WriteLine("Socket Exception: " + se.ErrorCode + " Message: " + se.Message);
    }

    if (!completedAsync)
    {
        // The call completed synchronously so invoke the callback ourselves
        SendCallback(this, e);
    }

}
Falco20019 commented 4 years ago

Are you using ASP.NET (Core) or a regular application? You can always use the tracer directly to create traces. But depending on your environment, you will need a way to setup the hierarchy of traces. If you only have a socket without protocol able to transmit meta data (like HTTP), it will be hard to transmit the Trace ID for follow-up attachment.

EngRajabi commented 4 years ago

im using asp core 3.1. Yes We had to use it manually in a number of places. For example, we would send a request to a service that uses the ISO 8583 protocol

Falco20019 commented 4 years ago

Have you already tried using https://github.com/opentracing-contrib/csharp-netcore ? This should work, even when handling the socket data yourself as it integrates with the pipeline, as long as you only write to the body of the request directly. If not, you can still create a span by using dependency injection (to get the ITracer) and basically trace it manually. The library should make sure that it gets attached to the correct trace.

Falco20019 commented 3 years ago

Feel free to reopen if still relevant.