history/statistics/statistics.proto

syntax = "proto3";

package jsgenerate_kb2022.history.statistics;
option go_package = "gateway/protocol/history/statistics";

import "google/api/annotations.proto";

// 統計一些數據
service Statistics {
    // 統計有多少設備 連接到服務器
    rpc Connected (ConnectedRequest) returns (ConnectedResponse){
        option (google.api.http) = {
            get: "/api/v1/history/statistics/connected"
        };
    }
    // 統計在不同優先級執行任務的設備數量
    rpc Priority (PriorityRequest) returns (PriorityResponse){
        option (google.api.http) = {
            get: "/api/v1/history/statistics/priority"
        };
    }
    // 統計在不同等級執行任務的設備數量
    rpc Level (LevelRequest) returns (LevelResponse){
        option (google.api.http) = {
            get: "/api/v1/history/statistics/level"
        };
    }
    // 統計一段時間內,不同優先級的調度器數量(因爲調度器和播放任務一致所以實際上就是播放任務數量)
    rpc SchedulerPriority (SchedulerPriorityRequest) returns (SchedulerPriorityResponse){
        option (google.api.http) = {
            get: "/api/v1/history/statistics/scheduler_priority"
        };
    }
    // 統計一段時間內,不同等級的調度器數量(因爲調度器和播放任務一致所以實際上就是播放任務數量)
    rpc SchedulerLevel (SchedulerLevelRequest) returns (SchedulerLevelResponse){
        option (google.api.http) = {
            get: "/api/v1/history/statistics/scheduler_level"
        };
    }
    // 統計一段時間內,不同來源的調度器數量(因爲調度器和播放任務一致所以實際上就是播放任務數量)
    rpc SchedulerSource(SchedulerSourceRequest) returns (SchedulerSourceResponse){
        option (google.api.http) = {
            get: "/api/v1/history/statistics/scheduler_source"
        };
    }
}
message ConnectedRequest{
    // 要統計的 目標,通常是區域邏輯碼
    repeated string targets = 1;
}
message ConnectedResponse{
    // 已經連接的設備
    uint32 connected = 1;
    // 未連接的設備
    uint32 disconnected = 2;
}
message PriorityRequest{
    // 要統計的 目標,通常是區域邏輯碼
    repeated string targets = 1;
    // 如果爲 true 則只統計已連接的設備否則也將未連接的設備納入統計
    bool connected = 2;
}
message Priority{
    // 這些設備執行的任務 優先級
    int32 priority = 1;
    // 有多少設備/調度器
    uint32 count = 2;
}
message PriorityResponse{
    repeated Priority data = 1;
}
message LevelRequest{
    // 要統計的 目標,通常是區域邏輯碼
    repeated string targets = 1;
    // 如果爲 true 則只統計已連接的設備否則也將未連接的設備納入統計
    bool connected = 2;
}
message Level{
    // 這些設備執行的任務 等級
    int32 level = 1;
    // 有多少設備/調度器
    uint32 count = 2;
}
message LevelResponse{
    repeated Level data = 1;
}
message SchedulerPriorityRequest{
    // 如果 >0 統計 開始時間 unix >= afert 的調度器
    int64 afert=1;
    // 如果 >0 統計 開始時間 unix <= before 的調度器
    int64 before=2;
    // 如果爲非空數組 只統計包含這些 邏輯碼 的調度器,否則同時整個系統的情況
    // 比如 成都的邏輯碼是 5101,則 使用 5101 可以統計成都下面的所有任務
    repeated string targets = 3;
}
message SchedulerPriorityResponse{
    repeated Priority data = 1;
}
message SchedulerLevelRequest{
    // 如果 >0 統計 開始時間 unix >= afert 的調度器
    int64 afert=1;
    // 如果 >0 統計 開始時間 unix <= before 的調度器
    int64 before=2;
    // 如果爲非空數組 只統計包含這些 邏輯碼 的調度器,否則同時整個系統的情況
    // 比如 成都的邏輯碼是 5101,則 使用 5101 可以統計成都下面的所有任務
    repeated string targets = 3;
}
message SchedulerLevelResponse{
    repeated Level data = 1;
}
message Source{
    // 來源自哪裏
    // * 100 音頻任務 -> 流程任務
    // * 110 音頻任務 -> 檔案直播
    // * 120 音頻任務 -> 即時直播
    // * 130 音頻任務 -> 點播
    int32 source = 1;
    // 有多少設備/調度器
    uint32 count = 2;
}
message SchedulerSourceRequest{
    // 如果 >0 統計 開始時間 unix >= afert 的調度器
    int64 afert=1;
    // 如果 >0 統計 開始時間 unix <= before 的調度器
    int64 before=2;
    // 如果爲非空數組 只統計包含這些 邏輯碼 的調度器,否則同時整個系統的情況
    // 比如 成都的邏輯碼是 5101,則 使用 5101 可以統計成都下面的所有任務
    repeated string targets = 3;
}
message SchedulerSourceResponse{
    repeated Source data = 1;
}