/*
 * Copyright (C) 2026 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 perfetto.protos;

// Arbitrary key value pairs which can attached to a trace to provide context
// about any facet of the trace. This can include, what data it contains,
// properties of the host / machine the trace was collected on, and other
// interesting information about a trace.
///
// Examples include:
// gradle_version = "9.0.10-alpha01"
// java_major_version = 24
///
// All keys get prefixed with `trace_attribute.` in the UI and in
// `traceprocessor`. If there are multiple trace attribute packets that use the
// same key, then the latest value wins.
// These key value pairs show up in the `Overview` section in
// Perfetto UI. Additionally, these key, value pairs can also be queried using
// Pefetto SQL by using the following query:
///
//`SELECT * FROM metadata WHERE name GLOB 'trace_attribute.*';`

message TraceAttributes {
  message Attribute {
    // The key
    optional string key = 1;
    // The value
    oneof value {
      int64 long_value = 2;
      string string_value = 3;
    }
  }

  repeated Attribute attribute = 1;
}
