common.fbtraceΒΆ

// Protocol Buffers for Saturnin firebird.trace microservices
// Copyright 2021 Firebird Project.  All rights reserved.
// https://www.firebirdsql.org/
// https://saturnin.rtfd.io
//
// License: The MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom
// the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

syntax = "proto3";

package saturnin.core.protobuf.fbtrace;

import "google/protobuf/timestamp.proto";

enum Status {
    STATUS_UNKNOWN      = 0 ;
    STATUS_OK           = 1 ;
    STATUS_FAILED       = 2 ;
    STATUS_UNAUTHORIZED = 3 ;
}

message AttachmentInfo {
    int64  id             = 1 ;
    string database       = 2 ;
    string charset        = 3 ;
    string protocol       = 4 ;
    string address        = 5 ;
    string user           = 6 ;
    string role           = 7 ;
    string remote_process = 8 ;
    int64  remote_pid     = 9 ;
}

message TransactionInfo {
             int64  id      = 1 ;
             int64  att_id  = 2 ;
    repeated string options = 3 ;
}

message ServiceInfo {
    int64  id             = 1 ;
    string user           = 2 ;
    string protocol       = 3 ;
    string address        = 4 ;
    string remote_process = 5 ;
    int64  remote_pid     = 6 ;
}

message SQLInfo {
    int64  id   = 1 ;
    string sql  = 2 ;
    string plan = 3 ;
}

message Param {
    string type = 1 ;
    string value = 2 ;
}

message ParamSet {
    uint32         id    = 1 ;
    repeated Param param = 2 ;
}

message AccessStats {
    string table   = 1 ;
    uint64 natural = 2 ;
    uint64 index   = 3 ;
    uint64 update  = 4 ;
    uint64 insert  = 5 ;
    uint64 delete  = 6 ;
    uint64 backout = 7 ;
    uint64 purge   = 8 ;
    uint64 expunge = 9 ;
}

message TraceEvent {
    uint64                    id        = 1 ;
    google.protobuf.Timestamp timestamp = 2 ;
}

message EventTraceInit {
    TraceEvent event   = 1 ;
    string     session = 2 ;
}

message EventTraceSuspend {
    TraceEvent event   = 1 ;
    string     session = 2 ;
}

message EventTraceFinish {
    TraceEvent event   = 1 ;
    string     session = 2 ;
}

message EventCreate {
    TraceEvent event          = 1 ;
    Status     status         = 2 ;
    int64      att_id         = 3 ;
    string     database       = 4 ;
    string     charset        = 5 ;
    string     protocol       = 6 ;
    string     address        = 7 ;
    string     user           = 8 ;
    string     role           = 9 ;
    string     remote_process = 10 ;
    int64      remote_pid     = 11 ;
}

message EventDrop {
    TraceEvent event          = 1 ;
    Status     status         = 2 ;
    int64      att_id         = 3 ;
    string     database       = 4 ;
    string     charset        = 5 ;
    string     protocol       = 6 ;
    string     address        = 7 ;
    string     user           = 8 ;
    string     role           = 9 ;
    string     remote_process = 10 ;
    int64      remote_pid     = 11 ;
}

message EventAttach {
    TraceEvent event          = 1 ;
    Status     status         = 2 ;
    int64      att_id         = 3 ;
    string     database       = 4 ;
    string     charset        = 5 ;
    string     protocol       = 6 ;
    string     address        = 7 ;
    string     user           = 8 ;
    string     role           = 9 ;
    string     remote_process = 10 ;
    int64      remote_pid     = 11 ;
}

message EventDetach {
    TraceEvent event          = 1 ;
    Status     status         = 2 ;
    int64      att_id         = 3 ;
    string     database       = 4 ;
    string     charset        = 5 ;
    string     protocol       = 6 ;
    string     address        = 7 ;
    string     user           = 8 ;
    string     role           = 9 ;
    string     remote_process = 10 ;
    int64      remote_pid     = 11 ;
}

message EventTransactionStart {
             TraceEvent event   = 1 ;
             Status     status  = 2 ;
             int64      att_id  = 3 ;
             int64      tra_id  = 4 ;
    repeated string     options = 5 ;
}

message EventCommit {
             TraceEvent event    = 1 ;
             Status     status   = 2 ;
             int64      att_id   = 3 ;
             int64      tra_id   = 4 ;
    repeated string     options  = 5 ;
             int64      run_time = 6 ;
             int64      reads    = 7 ;
             int64      writes   = 8 ;
             int64      fetches  = 9 ;
             int64      marks    = 10 ;
}

message EventRollback {
             TraceEvent event    = 1 ;
             Status     status   = 2 ;
             int64      att_id   = 3 ;
             int64      tra_id   = 4 ;
    repeated string     options  = 5 ;
             int64      run_time = 6 ;
             int64      reads    = 7 ;
             int64      writes   = 8 ;
             int64      fetches  = 9 ;
             int64      marks    = 10 ;
}

message EventCommitRetaining {
             TraceEvent event    = 1 ;
             Status     status   = 2 ;
             int64      att_id   = 3 ;
             int64      tra_id   = 4 ;
    repeated string     options  = 5 ;
             int64      run_time = 6 ;
             int64      reads    = 7 ;
             int64      writes   = 8 ;
             int64      fetches  = 9 ;
             int64      marks    = 10 ;
}

message EventRollbackRetaining {
             TraceEvent event    = 1 ;
             Status     status   = 2 ;
             int64      att_id   = 3 ;
             int64      tra_id   = 4 ;
    repeated string     options  = 5 ;
             int64      run_time = 6 ;
             int64      reads    = 7 ;
             int64      writes   = 8 ;
             int64      fetches  = 9 ;
             int64      marks    = 10 ;
}

message EventPrepareStatement {
    TraceEvent event   = 1 ;
    Status     status  = 2 ;
    int64      att_id  = 3 ;
    int64      tra_id  = 4 ;
    int64      stm_id  = 5 ;
    int64      sql_id  = 6 ;
    int64      prepare = 7 ;
}

message EventStatementStart {
    TraceEvent event    = 1 ;
    Status     status   = 2 ;
    int64      att_id   = 3 ;
    int64      tra_id   = 4 ;
    int64      stm_id   = 5 ;
    int64      sql_id   = 6 ;
    int64      param_id = 7 ;
}

message EventStatementFinish {
             TraceEvent  event    = 1 ;
             Status      status   = 2 ;
             int64       att_id   = 3 ;
             int64       tra_id   = 4 ;
             int64       stm_id   = 5 ;
             int64       sql_id   = 6 ;
             int64       param_id = 7 ;
             int64       records  = 8 ;
             int64       run_time = 9 ;
             int64       reads    = 10 ;
             int64       writes   = 11 ;
             int64       fetches  = 12 ;
             int64       marks    = 13 ;
    repeated AccessStats access   = 14 ;
}

message EventFreeStatement {
    TraceEvent event  = 1 ;
    int64      att_id = 3 ;
    int64      tra_id = 4 ;
    int64      stm_id = 5 ;
    int64      sql_id = 6 ;
}

message EventCloseCursor {
    TraceEvent event  = 1 ;
    int64      att_id = 3 ;
    int64      tra_id = 4 ;
    int64      stm_id = 5 ;
    int64      sql_id = 6 ;
}

message EventTriggerStart {
    TraceEvent event   = 1 ;
    Status     status  = 2 ;
    int64      att_id  = 3 ;
    int64      tra_id  = 4 ;
    string     trigger = 5 ;
    string     table   = 6 ;
    string     t_event = 7 ;
}

message EventTriggerFinish {
             TraceEvent  event    = 1 ;
             Status      status   = 2 ;
             int64       att_id   = 3 ;
             int64       tra_id   = 4 ;
             string      trigger  = 5 ;
             string      table    = 6 ;
             string      t_event  = 7 ;
             int64       run_time = 8 ;
             int64       reads    = 9 ;
             int64       writes   = 10 ;
             int64       fetches  = 11 ;
             int64       marks    = 12 ;
    repeated AccessStats access   = 13 ;
}

message EventProcedureStart {
    TraceEvent event     = 1 ;
    Status     status    = 2 ;
    int64      att_id    = 3 ;
    int64      tra_id    = 4 ;
    string     procedure = 5 ;
    int64      param_id  = 6 ;
}

message EventProcedureFinish {
             TraceEvent  event     = 1 ;
             Status      status    = 2 ;
             int64       att_id    = 3 ;
             int64       tra_id    = 4 ;
             string      procedure = 5 ;
             int64       param_id  = 6 ;
             int64       run_time  = 8 ;
             int64       reads     = 9 ;
             int64       writes    = 10 ;
             int64       fetches   = 11 ;
             int64       marks     = 12 ;
    repeated AccessStats access    = 13 ;
}

message EventServiceAttach {
    TraceEvent event     = 1 ;
    Status     status    = 2 ;
    int64      svc_id    = 3 ;
}

message EventServiceDetach {
    TraceEvent event     = 1 ;
    Status     status    = 2 ;
    int64      svc_id    = 3 ;
}

message EventServiceStart {
             TraceEvent event  = 1 ;
             Status     status = 2 ;
             int64      svc_id = 3 ;
             string     action = 4 ;
    repeated string     params = 5 ;
}

message EventServiceQuery {
             TraceEvent event  = 1 ;
             Status     status = 2 ;
             int64      svc_id = 3 ;
             string     action = 4 ;
    repeated string     params = 5 ;
}

message EventSetContext {
    TraceEvent event   = 1 ;
    Status     status  = 2 ;
    int64      att_id  = 3 ;
    int64      tra_id  = 4 ;
    string     context = 5 ;
    string     key     = 6 ;
    string     value   = 7 ;
}

message EventError {
             TraceEvent event   = 1 ;
             int64      att_id  = 2 ;
             string     place   = 3 ;
    repeated string     details = 4 ;
}

message EventWarning {
             TraceEvent event   = 1 ;
             int64      att_id  = 2 ;
             string     place   = 3 ;
    repeated string     details = 4 ;
}

message EventServiceError {
             TraceEvent event   = 1 ;
             int64      svc_id  = 2 ;
             string     place   = 3 ;
    repeated string     details = 4 ;
}

message EventServiceWarning {
             TraceEvent event   = 1 ;
             int64      svc_id  = 2 ;
             string     place   = 3 ;
    repeated string     details = 4 ;
}

message EventSweepStart {
    TraceEvent event  = 1 ;
    int64      att_id = 2 ;
    int64      oit    = 3 ;
    int64      oat    = 4 ;
    int64      ost    = 5 ;
    int64      next   = 6 ;
}

message EventSweepProgress {
             TraceEvent  event     = 1 ;
             int64       att_id    = 2 ;
             int64       run_time  = 3 ;
             int64       reads     = 4 ;
             int64       writes    = 5 ;
             int64       fetches   = 6 ;
             int64       marks     = 7 ;
    repeated AccessStats access    = 8 ;
}

message EventSweepFinish {
    TraceEvent event    = 1 ;
    int64      att_id   = 2 ;
    int64      oit      = 3 ;
    int64      oat      = 4 ;
    int64      ost      = 5 ;
    int64      next     = 6 ;
    int64      run_time = 7 ;
    int64      reads    = 8 ;
    int64      writes   = 9 ;
    int64      fetches  = 10 ;
    int64      marks    = 11 ;
}

message EventSweepFailed {
    TraceEvent event    = 1 ;
    int64      att_id   = 2 ;
}

message EventBLRCompile {
    TraceEvent event   = 1 ;
    Status     status  = 2 ;
    int64      att_id  = 3 ;
    int64      stm_id  = 4 ;
    string     content = 5 ;
    int64      prepare = 6 ;
}

message EventBLRExecute {
             TraceEvent  event    = 1 ;
             Status      status   = 2 ;
             int64       att_id   = 3 ;
             int64       tra_id   = 4 ;
             int64       stm_id   = 5 ;
             string      content  = 6 ;
             int64       run_time = 7 ;
             int64       reads    = 8 ;
             int64       writes   = 9 ;
             int64       fetches  = 10 ;
             int64       marks    = 11 ;
    repeated AccessStats access   = 12 ;
}

message EventDYNExecute {
    TraceEvent  event    = 1 ;
    Status      status   = 2 ;
    int64       att_id   = 3 ;
    int64       tra_id   = 4 ;
    string      content  = 5 ;
    int64       run_time = 6 ;
}

message EventUnknown {
    TraceEvent  event = 1 ;
    string      data  = 2 ;
}

// Firebird trace entry

message TraceEntry {
    oneof entry {
    AttachmentInfo         att_info            = 1 ;
    TransactionInfo        tra_info            = 2 ;
    ServiceInfo            svc_info            = 3 ;
    SQLInfo                sql_info            = 4 ;
    ParamSet               params              = 5 ;
    EventTraceInit         trace_init          = 6 ;
    EventTraceSuspend      trace_suspend       = 7 ;
    EventTraceFinish       trace_finish        = 8 ;
    EventCreate            db_create           = 9 ;
    EventDrop              db_drop             = 10 ;
    EventAttach            db_attach           = 11 ;
    EventDetach            db_detach           = 12 ;
    EventTransactionStart  tra_start           = 13 ;
    EventCommit            tra_commit          = 14 ;
    EventRollback          tra_rollback        = 15 ;
    EventCommitRetaining   tra_commit_retain   = 16 ;
    EventRollbackRetaining tra_rollback_retain = 17 ;
    EventPrepareStatement  stm_prepare         = 18 ;
    EventStatementStart    stm_start           = 19 ;
    EventStatementFinish   stm_finish          = 20 ;
    EventFreeStatement     stm_free            = 21 ;
    EventCloseCursor       cursor_close        = 22 ;
    EventTriggerStart      trigger_start       = 23 ;
    EventTriggerFinish     trigger_finish      = 24 ;
    EventProcedureStart    proc_start          = 25 ;
    EventProcedureFinish   proc_finish         = 26 ;
    EventServiceAttach     svc_attach          = 27 ;
    EventServiceDetach     svc_detach          = 28 ;
    EventServiceStart      svc_start           = 29 ;
    EventServiceQuery      svc_query           = 30 ;
    EventSetContext        ctx_set             = 31 ;
    EventError             error               = 32 ;
    EventWarning           warning             = 33 ;
    EventServiceError      svc_error           = 34 ;
    EventServiceWarning    svc_warning         = 35 ;
    EventSweepStart        swp_start           = 36 ;
    EventSweepProgress     swp_progress        = 37 ;
    EventSweepFinish       swp_finish          = 38 ;
    EventSweepFailed       swp_fail            = 39 ;
    EventBLRCompile        blr_compile         = 40 ;
    EventBLRExecute        blr_exec            = 41 ;
    EventDYNExecute        dyn_exec            = 42 ;
    EventUnknown           unknown             = 43 ;
    }
}