All Downloads are FREE. Search and download functionalities are using the official Maven repository.

banyandb.v1.banyandb-stream.proto Maven / Gradle / Ivy

There is a newer version: 0.8.0-rc0
Show newest version
// Licensed to Apache Software Foundation (ASF) under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Apache Software Foundation (ASF) licenses this file to you 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 = "proto3";

option java_package = "org.apache.skywalking.banyandb.stream.v1";

package banyandb.stream.v1;

import "google/protobuf/timestamp.proto";
import "validate/validate.proto";
import "banyandb/v1/banyandb-common.proto";
import "banyandb/v1/banyandb-model.proto";

// Element represents
// (stream context) a Span defined in Google Dapper paper or equivalently a Segment in Skywalking.
// (Log context) a log
message Element {
  // element_id could be span_id of a Span or segment_id of a Segment in the context of stream
  string element_id = 1;
  // timestamp represents a millisecond
  // 1) either the start time of a Span/Segment,
  // 2) or the timestamp of a log
  google.protobuf.Timestamp timestamp = 2;
  // fields contains all indexed Field. Some typical names,
  // - stream_id
  // - duration
  // - service_name
  // - service_instance_id
  // - end_time_milliseconds
  repeated model.v1.TagFamily tag_families = 3;
}

// QueryResponse is the response for a query to the Query module.
message QueryResponse {
  // elements are the actual data returned
  repeated Element elements = 1;
  // trace contains the trace information of the query when trace is enabled
  common.v1.Trace trace = 2;
}

// QueryRequest is the request contract for query.
message QueryRequest {
  // groups indicate where the elements are stored.
  repeated string groups = 1 [(validate.rules).repeated.min_items = 1];
  // name is the identity of a stream.
  string name = 2 [(validate.rules).string.min_len = 1];
  // time_range is a range query with begin/end time of entities in the timeunit of milliseconds.
  // In the context of stream, it represents the range of the `startTime` for spans/segments,
  // while in the context of Log, it means the range of the timestamp(s) for logs.
  // it is always recommended to specify time range for performance reason
  model.v1.TimeRange time_range = 3;
  // offset is used to support pagination, together with the following limit
  uint32 offset = 4;
  // limit is used to impose a boundary on the number of records being returned
  uint32 limit = 5;
  // order_by is given to specify the sort for a field. So far, only fields in the type of Integer are supported
  model.v1.QueryOrder order_by = 6;
  // tag_families are indexed.
  model.v1.Criteria criteria = 7;
  // projection can be used to select the key names of the element in the response
  model.v1.TagProjection projection = 8 [(validate.rules).message.required = true];
  // trace is used to enable trace for the query
  bool trace = 9;
}

message ElementValue {
  // element_id could be span_id of a Span or segment_id of a Segment in the context of stream
  string element_id = 1;
  // timestamp is in the timeunit of milliseconds. It represents
  // 1) either the start time of a Span/Segment,
  // 2) or the timestamp of a log
  google.protobuf.Timestamp timestamp = 2;
  // the order of tag_families' items match the stream schema
  repeated model.v1.TagFamilyForWrite tag_families = 3;
}

message WriteRequest {
  // the metadata is required.
  common.v1.Metadata metadata = 1 [(validate.rules).message.required = true];
  // the element is required.
  ElementValue element = 2 [(validate.rules).message.required = true];
  // the message_id is required.
  uint64 message_id = 3 [(validate.rules).uint64.gt = 0];
}

message WriteResponse {
  // the message_id from request.
  uint64 message_id = 1 [(validate.rules).uint64.gt = 0];
  // status indicates the request processing result
  model.v1.Status status = 2 [(validate.rules).enum.defined_only = true];
  // the metadata from request when request fails
  common.v1.Metadata metadata = 3;
}

service StreamService {
  rpc Query(banyandb.stream.v1.QueryRequest) returns (banyandb.stream.v1.QueryResponse);
  rpc Write(stream banyandb.stream.v1.WriteRequest) returns (stream banyandb.stream.v1.WriteResponse);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy