示例#1
0
        public void AfterDbSessionInvoke([Object] DbSessionInvokeAfterEventData eventData)
        {
            var context = _localSegmentContextAccessor.Context;

            if (context != null)
            {
                context.Span.AddTag("from_cache", eventData.ExecutionContext.Result.FromCache);
                context.Span.Peer = new Common.StringOrIntValue(eventData.DbSession.Connection?.DataSource);
                context.Span.AddTag(Common.Tags.DB_INSTANCE, eventData.DbSession.Connection?.Database);
                context.Span.AddTag(Common.Tags.DB_STATEMENT, eventData.ExecutionContext.Request.RealSql);
                _tracingContext.Release(context);
            }
        }
        public void AfterDbSessionInvoke([Object] DbSessionInvokeAfterEventData eventData)
        {
            var context = _localSegmentContextAccessor.Context;

            if (context != null)
            {
                context.Span.AddTag("from_cache", eventData.ExecutionContext.Result.FromCache);
                var resultSize = eventData.ExecutionContext.Result.IsList
                    ? (eventData.ExecutionContext.Result.GetData() as ICollection)?.Count
                    : 1;
                context.Span.AddTag("result_size", resultSize?.ToString());
                _tracingContext.Release(context);
            }
        }