Closed EngRajabi closed 3 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?
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);
}
}
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.
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
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.
Feel free to reopen if still relevant.
It is possible that cases where the socket class is made manually. Tracking done?