Closed xsmrcek closed 1 year ago
hi @xsmrcek, Spans attributes are not generally readable, can you describe your use case in a bit more detail? e.g. what attribute(s) do you want to read, are those spans from auto-instrumentation? what do you want to update them with?
HI @trask My use case is for logging purposes. I would like to have my requests/responses in custom properties of request/dependencies in application inisghts. For some large logs I don't have access to whole log at time, instead of that I have one part at the time. I would like to be able to check if Span attibute (like Server Request Body) already exist and if it does, just append another part of log to it. Spans are from auto-instrumentation and I would like to update just my custom Span attributes.
I would like to have my requests/responses in custom properties of request/dependencies in application inisghts.
is there a reason why you don't want to capture these in log ("trace") records which would be correlated to (parent) the request?
For some large logs I don't have access to whole log at time
what size? there is limitation of 8k on custom properties, see https://learn.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#limits
there are some more options, but would like to understand these first since this would generally be the easiest way to just log what you want to capture
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.
Hi @trask , I do not want to capture logs as traces by default. As I do log a lot of data and I would like to log just some of them to application insights. Putting them to custom properties makes them more readable too as traces may be difficult to read in really huge chains of requests. Size may differ according to configuration of service. I would like to capture at least part of request/response as custom properties. I wanted to do it inside of our logging system, problem is that it is chunking logs and I have no way to known if it is a first chunk or last one. I will probably try to find better solution. Thank you for feedback tho!
hey @xsmrcek, one way to accomplish this would be to store the value in the OpenTelemetry Context
, and each time you append to that value, you can also update/overwrite the attribute on the local root span.
Hey @trask thank you for suggerstion! I will keep it in mind :)
I would like to be able to get attributes of current Span. In one of my projects I have to set some attributes, but I don't know if Span already have them. I would like to be able to get attributes or to be able to concat them.