/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto2";

package android.os.statsd.expresslog;

import "frameworks/proto_logging/stats/atoms.proto";
import "frameworks/proto_logging/stats/atom_field_options.proto";

option java_package = "com.android.os.expresslog";
option java_multiple_files = true;

extend Atom {
    optional ExpressEventReported express_event_reported =
            528 [(module) = "framework", (module) = "expresslog", (module) = "statsdtest"];
    optional ExpressHistogramSampleReported express_histogram_sample_reported =
            593 [(module) = "framework", (module) = "expresslog"];
    optional ExpressUidEventReported express_uid_event_reported =
            644 [(module) = "framework", (module) = "expresslog"];
    optional ExpressUidHistogramSampleReported express_uid_histogram_sample_reported =
            658 [(module) = "framework", (module) = "expresslog"];
}

/*
 * Logs by Express library.
 */
message ExpressEventReported {
    optional int64 metric_id = 1;

    // for counter metric it is an incremental amount
    optional int64 value = 2;
}

/*
 * Logs by Express library.
 */
message ExpressUidEventReported {
    optional int64 metric_id = 1;

    // for counter metric it is an incremental amount
    optional int64 value = 2;

    // will be used as uid dimension.
    optional int32 uid = 3 [(is_uid) = true];
}

/*
 * Logs by Express library.
 */
message ExpressHistogramSampleReported {
    optional int64 metric_id = 1;

    // will be used as a samples count increment value per bin
    optional int64 count = 2;

    // will be used as a dimension to represent the bin index
    // dim[0] .. dim[bins_count - 1] - valid samples count bins
    // 2 extra bins reserved to represent underflow/overflow
    // dim[bins_count] - could be considered as an underflow bin
    // dim[bins_count + 1] - could be considered as an overflow bin
    optional int32 bin_index = 3;
}

/*
 * Logs by Express library.
 */
 message ExpressUidHistogramSampleReported {
    optional int64 metric_id = 1;

    // will be used as a samples count increment value per bin
    optional int64 count = 2;

    // will be used as a dimension to represent the bin index
    // dim[0] .. dim[bins_count - 1] - valid samples count bins
    // 2 extra bins reserved to represent underflow/overflow
    // dim[bins_count] - could be considered as an underflow bin
    // dim[bins_count + 1] - could be considered as an overflow bin
    optional int32 bin_index = 3;

    // will be used as uid dimension.
    optional int32 uid = 4 [(is_uid) = true];
}
