Skip to content

Commit

Permalink
protos moved from Java repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Kanzhelev committed May 22, 2019
1 parent 197ea3f commit b5bcfff
Show file tree
Hide file tree
Showing 10 changed files with 928 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@

# Language Independent Interface Types For OpenTelemetry
10 changes: 10 additions & 0 deletions src/opentelemetry/proto/agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# OpenTelemetry Agent Proto

This package describes the OpenTelemetry Agent protocol.

## Packages

1. `common` package contains the common messages shared between different services, such as
`Node`, `Service` and `Library` identifiers.
2. `trace` package contains the Trace Service protos.
3. `metrics` package contains the Metrics Service protos.
96 changes: 96 additions & 0 deletions src/opentelemetry/proto/agent/common/v1/common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// Copyright 2019, 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";

// NOTE: This proto is experimental and is subject to change at this point.
// Please do not use it at the moment.

package opentelemetry.proto.agent.common.v1;

import "google/protobuf/timestamp.proto";

option java_multiple_files = true;
option java_package = "io.opentelemetry.proto.agent.common.v1";
option java_outer_classname = "CommonProto";

// Identifier metadata of the Node that produces the span or tracing data.
// Note, this is not the metadata about the Node or service that is described by associated spans.
// In the future we plan to extend the identifier proto definition to support
// additional information (e.g cloud id, etc.)
message Node {
// Identifier that uniquely identifies a process within a VM/container.
ProcessIdentifier identifier = 1;

// Information on the OpenTelemetry Library that initiates the stream.
LibraryInfo library_info = 2;

// Additional information on service.
ServiceInfo service_info = 3;

// Additional attributes.
map<string, string> attributes = 4;

// TODO(songya): Add more identifiers in the future as needed, like cloud
// identifiers.
}

// Identifier that uniquely identifies a process within a VM/container.
message ProcessIdentifier {

// The host name. Usually refers to the machine/container name.
// For example: os.Hostname() in Go, socket.gethostname() in Python.
string host_name = 1;

// Process id.
uint32 pid = 2;

// Start time of this ProcessIdentifier. Represented in epoch time.
google.protobuf.Timestamp start_timestamp = 3;
}

// Information on OpenTelemetry Library.
message LibraryInfo {

enum Language {
LANGUAGE_UNSPECIFIED = 0;
CPP = 1;
C_SHARP = 2;
ERLANG = 3;
GO_LANG = 4;
JAVA = 5;
NODE_JS = 6;
PHP = 7;
PYTHON = 8;
RUBY = 9;
}

// Language of OpenTelemetry Library.
Language language = 1;

// Version of Agent exporter of Library.
string exporter_version = 2;

// Version of OpenTelemetry Library.
string core_library_version = 3;
}

// Additional service information.
message ServiceInfo {

// Name of the service.
string name = 1;

// TODO(songya): add more fields as needed.
}
54 changes: 54 additions & 0 deletions src/opentelemetry/proto/agent/metrics/v1/metrics_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright 2019, 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.agent.metrics.v1;

import "agent/common/v1/common.proto";
import "metrics/v1/metrics.proto";
import "resource/v1/resource.proto";

option java_multiple_files = true;
option java_package = "io.opentelemetry.proto.agent.metrics.v1";
option java_outer_classname = "MetricsServiceProto";

// Service that can be used to push metrics between one Application
// instrumented with OpenTelemetry and an agent, or between an agent and a
// central collector.
service MetricsService {
// For performance reasons, it is recommended to keep this RPC
// alive for the entire life of the application.
rpc Export(stream ExportMetricsServiceRequest) returns (stream ExportMetricsServiceResponse) {}
}

message ExportMetricsServiceRequest {
// This is required only in the first message on the stream or if the
// previous sent ExportMetricsServiceRequest message has a different Node (e.g.
// when the same RPC is used to send Metrics from multiple Applications).
opentelemetry.proto.agent.common.v1.Node node = 1;

// A list of metrics that belong to the last received Node.
repeated opentelemetry.proto.metrics.v1.Metric metrics = 2;

// The resource for the metrics in this message that do not have an explicit
// resource set.
// If unset, the most recently set resource in the RPC stream applies. It is
// valid to never be set within a stream, e.g. when no resource info is known
// at all or when all sent metrics have an explicit resource set.
opentelemetry.proto.resource.v1.Resource resource = 3;
}

message ExportMetricsServiceResponse {
}
83 changes: 83 additions & 0 deletions src/opentelemetry/proto/agent/trace/v1/trace_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright 2019, 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";

// NOTE: This proto is experimental and is subject to change at this point.
// Please do not use it at the moment.

package opentelemetry.proto.agent.trace.v1;

import "agent/common/v1/common.proto";
import "resource/v1/resource.proto";
import "trace/v1/trace.proto";
import "trace/v1/trace_config.proto";

option java_multiple_files = true;
option java_package = "io.opentelemetry.proto.agent.trace.v1";
option java_outer_classname = "TraceServiceProto";

// Service that can be used to push spans and configs between one Application
// instrumented with OpenTelemetry and an agent, or between an agent and a
// central collector or config service (in this case spans and configs are
// sent/received to/from multiple Applications).
service TraceService {
// After initialization, this RPC must be kept alive for the entire life of
// the application. The agent pushes configs down to applications via a
// stream.
rpc Config(stream CurrentLibraryConfig) returns (stream UpdatedLibraryConfig) {}

// For performance reasons, it is recommended to keep this RPC
// alive for the entire life of the application.
rpc Export(stream ExportTraceServiceRequest) returns (stream ExportTraceServiceResponse) {}
}

message CurrentLibraryConfig {
// This is required only in the first message on the stream or if the
// previous sent CurrentLibraryConfig message has a different Node (e.g.
// when the same RPC is used to configure multiple Applications).
opentelemetry.proto.agent.common.v1.Node node = 1;

// Current configuration.
opentelemetry.proto.trace.v1.TraceConfig config = 2;
}

message UpdatedLibraryConfig {
// This field is ignored when the RPC is used to configure only one Application.
// This is required only in the first message on the stream or if the
// previous sent UpdatedLibraryConfig message has a different Node.
opentelemetry.proto.agent.common.v1.Node node = 1;

// Requested updated configuration.
opentelemetry.proto.trace.v1.TraceConfig config = 2;
}

message ExportTraceServiceRequest {
// This is required only in the first message on the stream or if the
// previous sent ExportTraceServiceRequest message has a different Node (e.g.
// when the same RPC is used to send Spans from multiple Applications).
opentelemetry.proto.agent.common.v1.Node node = 1;

// A list of Spans that belong to the last received Node.
repeated opentelemetry.proto.trace.v1.Span spans = 2;

// The resource for the spans in this message that do not have an explicit
// resource set.
// If unset, the most recently set resource in the RPC stream applies. It is
// valid to never be set within a stream, e.g. when no resource info is known.
opentelemetry.proto.resource.v1.Resource resource = 3;
}

message ExportTraceServiceResponse {
}
12 changes: 12 additions & 0 deletions src/opentelemetry/proto/agent/trace/v1/trace_service_http.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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.agent.trace.v1.TraceService.Export
post: /v1/trace
body: "*"
- selector: opentelemetry.proto.agent.metrics.v1.MetricsService.Export
post: /v1/trace
body: "*"
Loading

0 comments on commit b5bcfff

Please sign in to comment.