Esempio n. 1
0
        public void BeforeExecuteCommand(MySqlDataTraceCommand sqlCommand)
        {
            var context = _tracingContext.CreateExitSegmentContext(ResolveOperationName(sqlCommand),
                                                                   sqlCommand.DbServer);

            context.Span.SpanLayer = Tracing.Segments.SpanLayer.DB;
            context.Span.Component = Common.Components.SQLCLIENT;
            context.Span.AddTag(Common.Tags.DB_TYPE, "MySql");
            context.Span.AddTag(Common.Tags.DB_INSTANCE, sqlCommand.Database);
            context.Span.AddTag(Common.Tags.DB_STATEMENT, sqlCommand.SqlText);
        }
Esempio n. 2
0
        private MySqlDataTraceCommand GetCommand(object driverIdObj, object cmd)
        {
            var command = new MySqlDataTraceCommand();

            if (_dbConn.TryGetValue((long)driverIdObj, out var database))
            {
                command.Database = database.Database;
                command.DbServer = database.Server;
            }

            command.SqlText = (cmd == null ? "" : cmd.ToString());
            return(command);
        }
Esempio n. 3
0
        private static string ResolveOperationName(MySqlDataTraceCommand sqlCommand)
        {
            var commandType = sqlCommand.SqlText?.Split(' ');

            return($"{MySqlDataDiagnosticStrings.MySqlDataPrefix}{commandType?.FirstOrDefault()}");
        }