Add resource to protocol (#137)

Signed-off-by: Fabian Reinartz <freinartz@google.com>
pull/147/head
Fabian Reinartz 6 years ago committed by Yang Song
parent 61f8bc77ec
commit fc93f641b0
  1. 2
      src/opencensus/proto/agent/metrics/v1/BUILD.bazel
  2. 8
      src/opencensus/proto/agent/metrics/v1/metrics_service.proto
  3. 2
      src/opencensus/proto/agent/trace/v1/BUILD.bazel
  4. 7
      src/opencensus/proto/agent/trace/v1/trace_service.proto
  5. 4
      src/opencensus/proto/metrics/v1/BUILD.bazel
  6. 5
      src/opencensus/proto/metrics/v1/metrics.proto
  7. 41
      src/opencensus/proto/resource/v1/BUILD.bazel
  8. 33
      src/opencensus/proto/resource/v1/resource.proto

@ -23,6 +23,7 @@ proto_library(
deps = [
"//opencensus/proto/agent/common/v1:common_proto",
"//opencensus/proto/metrics/v1:metrics_proto",
"//opencensus/proto/resource/v1:resource_proto",
],
)
@ -51,6 +52,7 @@ go_proto_library(
proto_deps = [
"//opencensus/proto/agent/common/v1:common_proto_go",
"//opencensus/proto/metrics/v1:metrics_proto_go",
"//opencensus/proto/resource/v1:resource_proto_go",
],
pb_options = [
# omit the go_package declared in proto files to make bazel works as expect

@ -18,6 +18,7 @@ package opencensus.proto.agent.metrics.v1;
import "opencensus/proto/agent/common/v1/common.proto";
import "opencensus/proto/metrics/v1/metrics.proto";
import "opencensus/proto/resource/v1/resource.proto";
option java_multiple_files = true;
option java_package = "io.opencensus.proto.agent.metrics.v1";
@ -42,6 +43,13 @@ message ExportMetricsServiceRequest {
// A list of metrics that belong to the last received Node.
repeated opencensus.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.
opencensus.proto.resource.v1.Resource resource = 3;
}
message ExportMetricsServiceResponse {

@ -22,6 +22,7 @@ proto_library(
srcs = ["trace_service.proto"],
deps = [
"//opencensus/proto/agent/common/v1:common_proto",
"//opencensus/proto/resource/v1:resource_proto",
"//opencensus/proto/trace/v1:trace_proto",
"//opencensus/proto/trace/v1:trace_config_proto",
],
@ -51,6 +52,7 @@ go_proto_library(
],
proto_deps = [
"//opencensus/proto/agent/common/v1:common_proto_go",
"//opencensus/proto/resource/v1:resource_proto_go",
"//opencensus/proto/trace/v1:trace_proto_go",
"//opencensus/proto/trace/v1:trace_config_proto_go",
],

@ -20,6 +20,7 @@ syntax = "proto3";
package opencensus.proto.agent.trace.v1;
import "opencensus/proto/agent/common/v1/common.proto";
import "opencensus/proto/resource/v1/resource.proto";
import "opencensus/proto/trace/v1/trace.proto";
import "opencensus/proto/trace/v1/trace_config.proto";
@ -72,6 +73,12 @@ message ExportTraceServiceRequest {
// A list of Spans that belong to the last received Node.
repeated opencensus.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.
opencensus.proto.resource.v1.Resource resource = 3;
}
message ExportTraceServiceResponse {

@ -22,6 +22,7 @@ proto_library(
deps = [
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
"//opencensus/proto/resource/v1:resource_proto",
],
)
@ -48,6 +49,9 @@ go_proto_library(
# omit the go_package declared in proto files to make bazel works as expect
"paths=source_relative",
],
proto_deps = [
"//opencensus/proto/resource/v1:resource_proto_go",
],
deps = [
"@com_github_golang_protobuf//ptypes/timestamp:go_default_library",
"@com_github_golang_protobuf//ptypes/wrappers:go_default_library",

@ -23,6 +23,7 @@ package opencensus.proto.metrics.v1;
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "opencensus/proto/resource/v1/resource.proto";
option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1";
@ -48,6 +49,10 @@ message Metric {
// One or more timeseries for a single metric, where each timeseries has
// one or more points.
repeated TimeSeries timeseries = 3;
// The resource for the metric. If unset, it may be set to a default value
// provided for a sequence of messages in an RPC stream.
opencensus.proto.resource.v1.Resource resource = 4;
}
// Defines a metric type and its schema.

@ -0,0 +1,41 @@
# Copyright 2018, OpenCensus 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.
package(default_visibility = ["//visibility:public"])
load("@org_pubref_rules_protobuf//go:rules.bzl", "go_proto_library")
proto_library(
name = "resource_proto",
srcs = ["resource.proto"],
)
cc_proto_library(
name = "resource_proto_cc",
deps = [":resource_proto"],
)
java_proto_library(
name = "resource_proto_java",
deps = [":resource_proto"],
)
go_proto_library(
name = "resource_proto_go",
protos = ["resource.proto"],
pb_options = [
# omit the go_package declared in proto files to make bazel works as expect
"paths=source_relative",
],
)

@ -0,0 +1,33 @@
// Copyright 2018, OpenCensus 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 opencensus.proto.resource.v1;
option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1";
option java_multiple_files = true;
option java_package = "io.opencensus.proto.resource.v1";
option java_outer_classname = "ResourceProto";
// Resource information.
message Resource {
// Type identifier for the resource.
string type = 1;
// Set of labels that describe the resource.
map<string,string> labels = 2;
}
Loading…
Cancel
Save