Skip to content

Commit

Permalink
Add entities
Browse files Browse the repository at this point in the history
  • Loading branch information
tigrannajaryan committed Feb 21, 2024
1 parent 9d139c8 commit 693e970
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 0 deletions.
75 changes: 75 additions & 0 deletions opentelemetry/proto/collector/entities/v1/entities_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright 2020, OpenTelemetry Authors
//
// 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 = "proto3";

package opentelemetry.proto.collector.entities.v1;

import "opentelemetry/proto/entities/v1/entities.proto";

option csharp_namespace = "OpenTelemetry.Proto.Collector.Entities.V1";
option java_multiple_files = true;
option java_package = "io.opentelemetry.proto.collector.entities.v1";
option java_outer_classname = "EntitiesServiceProto";
option go_package = "go.opentelemetry.io/proto/otlp/collector/entities/v1";

// Service that can be used to push entities between one Application instrumented with
// OpenTelemetry and an collector, or between an collector and a central collector (in this
// case entities are sent/received to/from multiple Applications).
service EntitiesService {
// For performance reasons, it is recommended to keep this RPC
// alive for the entire life of the application.
rpc Export(ExportEntitiesServiceRequest) returns (ExportEntitiesServiceResponse) {}
}

message ExportEntitiesServiceRequest {
// An array of ResourceEntities.
repeated opentelemetry.proto.entities.v1.ScopeEntities scope_entities = 1;
}

message ExportEntitiesServiceResponse {
// The details of a partially successful export request.
//
// If the request is only partially accepted
// (i.e. when the server accepts only parts of the data and rejects the rest)
// the server MUST initialize the `partial_success` field and MUST
// set the `rejected_<signal>` with the number of items it rejected.
//
// Servers MAY also make use of the `partial_success` field to convey
// warnings/suggestions to senders even when the request was fully accepted.
// In such cases, the `rejected_<signal>` MUST have a value of `0` and
// the `error_message` MUST be non-empty.
//
// A `partial_success` message with an empty value (rejected_<signal> = 0 and
// `error_message` = "") is equivalent to it not being set/present. Senders
// SHOULD interpret it the same way as in the full success case.
ExportEntitiesPartialSuccess partial_success = 1;
}

message ExportEntitiesPartialSuccess {
// The number of rejected log records.
//
// A `rejected_<signal>` field holding a `0` value indicates that the
// request was fully accepted.
int64 rejected_entities = 1;

// A developer-facing human-readable message in English. It should be used
// either to explain why the server rejected parts of the data during a partial
// success or to convey warnings/suggestions during a full success. The message
// should offer guidance on how users can address such issues.
//
// error_message is an optional field. An error_message with an empty value
// is equivalent to it not being set.
string error_message = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This is an API configuration to generate an HTTP/JSON -> gRPC gateway for the
# OpenTelemetry service using github.com/grpc-ecosystem/grpc-gateway.
type: google.api.Service
config_version: 3
http:
rules:
- selector: opentelemetry.proto.collector.entities.v1.EntitiesService.Export
post: /v1/entities
body: "*"
79 changes: 79 additions & 0 deletions opentelemetry/proto/entities/v1/entities.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright 2020, OpenTelemetry Authors
//
// 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 = "proto3";

package opentelemetry.proto.entities.v1;

import "opentelemetry/proto/common/v1/common.proto";
import "opentelemetry/proto/resource/v1/resource.proto";

option csharp_namespace = "OpenTelemetry.Proto.Entities.V1";
option java_multiple_files = true;
option java_package = "io.opentelemetry.proto.entities.v1";
option java_outer_classname = "EntitiesProto";
option go_package = "go.opentelemetry.io/proto/otlp/entities/v1";

// EntitiesData represents the entities data that can be stored in a persistent storage,
// OR can be embedded by other protocols that transfer OTLP entities data but do not
// implement the OTLP protocol.
//
// The main difference between this message and collector protocol is that
// in this message there will not be any "control" or "metadata" specific to
// OTLP protocol.
//
// When new fields are added into this message, the OTLP request MUST be updated
// as well.
message EntitiesData {
repeated ScopeEntities scope_entities = 1;
}

// A collection of Entities produced by a Scope.
message ScopeEntities {
// The instrumentation scope information for the entities in this message.
// Semantically when InstrumentationScope isn't set, it is equivalent with
// an empty instrumentation scope name (unknown).
opentelemetry.proto.common.v1.InstrumentationScope scope = 1;

repeated EntityEvent entity_events = 2;

// This schema_url applies to all entities in the "entity_events" field.
string schema_url = 3;
}

// The full state of the Entity.
message EntityEvent {
// Time when this state was observed.
uint64 time_unix_nano = 1;

// Type of the entity, e.g. "service", "host", etc.
string type = 2;

// Set of attributes that identify the entity.
repeated opentelemetry.proto.common.v1.KeyValue id = 3;

oneof data {
EntityState state = 4;
EntityDelete delete = 5;
}
}

message EntityState {
// Set of non-identifying attributes only.
repeated opentelemetry.proto.common.v1.KeyValue attributes = 4;
uint32 dropped_attributes_count = 5;
}

message EntityDelete {
}
7 changes: 7 additions & 0 deletions opentelemetry/proto/resource/v1/resource.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,11 @@ message Resource {
// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
// no attributes were dropped.
uint32 dropped_attributes_count = 2;

// Defines the producing entity type of this resource, e.g "service", "k8s.pod", etc.
string entity_type = 3;

// Set of attributes that identify the producing entity.
// Note that the identifying attributes may be also recorded in the "attributes" field.
repeated opentelemetry.proto.common.v1.KeyValue entity_id = 4;
}

0 comments on commit 693e970

Please sign in to comment.