diff --git a/opentelemetry/proto/collector/discovery/v1/discovery_service.proto b/opentelemetry/proto/collector/discovery/v1/discovery_service.proto new file mode 100644 index 00000000..82a6f6b8 --- /dev/null +++ b/opentelemetry/proto/collector/discovery/v1/discovery_service.proto @@ -0,0 +1,82 @@ +// 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.discovery.v1; + +import "opentelemetry/proto/discovery/v1/discovery.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Collector.Discovery.V1"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.collector.discovery.v1"; +option java_outer_classname = "DiscoveryServiceProto"; +option go_package = "go.opentelemetry.io/proto/otlp/collector/discovery/v1"; +//option go_package = "discovery/v1"; + + +// Service that can be used to push Discovery between one Application instrumented with +// OpenTelemetry and an collector, or between an collector and a central collector (in this +// case Discovery are sent/received to/from multiple Applications). +service DiscoveryService { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + rpc Export(ExportDiscoveryServiceRequest) returns (ExportDiscoveryServiceResponse) {} +} + +message ExportDiscoveryServiceRequest { + // An array of DiscoveryDiscovery. + // For data coming from a single discovery this array will typically contain one + // element. Intermediary nodes (such as OpenTelemetry Collector) that receive + // data from multiple origins typically batch the data before forwarding further and + // in that case this array will contain multiple elements. + + repeated opentelemetry.proto.discovery.v1.ResourceDiscovery resource_discovery = 1; +} + +message ExportDiscoveryServiceResponse { + // 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_` 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_` MUST have a value of `0` and + // the `error_message` MUST be non-empty. + // + // A `partial_success` message with an empty value (rejected_ = 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. + ExportDiscoveryPartialSuccess partial_success = 1; +} + +message ExportDiscoveryPartialSuccess { + // The number of rejected discovery records. + // + // A `rejected_` field holding a `0` value indicates that the + // request was fully accepted. + int64 rejected_discovery_records = 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; +} diff --git a/opentelemetry/proto/collector/discovery/v1/discovery_service_http.yaml b/opentelemetry/proto/collector/discovery/v1/discovery_service_http.yaml new file mode 100644 index 00000000..a9fbbb21 --- /dev/null +++ b/opentelemetry/proto/collector/discovery/v1/discovery_service_http.yaml @@ -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.discovery.v1.DiscoveryService.Export + post: /v1/resources + body: "*" \ No newline at end of file diff --git a/opentelemetry/proto/discovery/v1/discovery.proto b/opentelemetry/proto/discovery/v1/discovery.proto new file mode 100644 index 00000000..f7cfb6b4 --- /dev/null +++ b/opentelemetry/proto/discovery/v1/discovery.proto @@ -0,0 +1,87 @@ +// 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.discovery.v1; + +import "opentelemetry/proto/common/v1/common.proto"; +import "opentelemetry/proto/resource/v1/resource.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Discovery.V1"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.discovery.v1"; +option java_outer_classname = "DiscoveryProto"; +option go_package = "go.opentelemetry.io/proto/otlp/discovery/v1"; +//option go_package = "discovery/v1"; +// LogsData represents the logs data that can be stored in a persistent storage, +// OR can be embedded by other protocols that transfer OTLP logs 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 DiscoveryData { + // An array of ResourceLogs. + // For data coming from a single resource this array will typically contain + // one element. Intermediary nodes that receive data from multiple origins + // typically batch the data before forwarding further and in that case this + // array will contain multiple elements. + repeated ResourceDiscovery resource_discovery = 1; +} + +// A collection of ScopeLogs from a Resource. +message ResourceDiscovery { + reserved 1000; + + // The resource for the logs in this message. + // If this field is not set then resource info is unknown. + opentelemetry.proto.resource.v1.Resource resource = 1; + + // A list of ScopeLogs that originate from a resource. + repeated ScopeDiscovery scope_discovery = 2; + + // The Schema URL, if known. This is the identifier of the Schema that the resource data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + // This schema_url applies to the data in the "resource" field. It does not apply + // to the data in the "scope_logs" field which have their own schema_url field. + string schema_url = 3; +} + +// A collection of Logs produced by a Scope. +message ScopeDiscovery { + // The instrumentation scope information for the logs 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; + + // A list of log records. + repeated DiscoveryRecord discovery_records = 2; + + // The Schema URL, if known. This is the identifier of the Schema that the log data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + // This schema_url applies to all logs in the "logs" field. + string schema_url = 3; +} + +message DiscoveryRecord { + reserved 4; + opentelemetry.proto.resource.v1.Resource resource = 1; +} +