// protoc --go_out=. --go_opt=paths=source_relative     --go-grpc_out=. --go-grpc_opt=paths=source_relative     abn/grpc/abn.proto
// python -m grpc_tools.protoc -I../../../iter8-tools/iter8/abn/grpc --python_out=. --grpc_python_out=. ../../../iter8-tools/iter8/abn/grpc/abn.proto 

syntax = "proto3";

option go_package = "github.com/iter8-tools/iter8/abn/grpc";

import "google/protobuf/empty.proto";
package main;

// for more information, see https://github.com/iter8-tools/iter8/issues/1257

service ABN {
  // Identify a version (index) the caller should send a request to.
  // Should be called for each request (transaction).
  rpc Lookup(Application) returns(VersionRecommendation) {}

  // Write a metric value to metrics database.
  // The metric value is explicitly associated with a list of transactions that contributed to its computation.
  // The user is expected to identify these transactions.
  rpc WriteMetric(MetricValue) returns (google.protobuf.Empty) {}
}

message Application {
  // name of (backend) application or service
  // This value is used to identify the Kubernetes objects that make up the service
  // Kubernetes objects that comprise the service should have the label app.kubernetes.io/name set to name
  string name = 1;
  // User or user session identifier
  string user = 2;
}

message VersionRecommendation {
  // versionNumber index of an application version
  int32 versionNumber = 1;
}

message MetricValue {
  // Metric name
  string name = 1;
  // Metric value
  string value = 2;
  // name of application
  string application = 3;
  // User or user session identifier
  string user = 4;
}

// https://developers.google.com/protocol-buffers/docs/proto3