Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit ed45831

Browse files
authored
Add trace_config.proto. (#80)
* Add trace_config.proto * Combine AlwaysSampler and NeverSampler. * Make trace_config_proto a separate library.
1 parent 0857a45 commit ed45831

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

opencensus/proto/trace/BUILD.bazel

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,27 @@ proto_library(
2323
],
2424
)
2525

26+
proto_library(
27+
name = "trace_config_proto",
28+
srcs = ["trace_config.proto"],
29+
)
30+
2631
cc_proto_library(
2732
name = "trace_proto_cc",
2833
deps = [":trace_proto"],
2934
)
3035

36+
cc_proto_library(
37+
name = "trace_config_proto_cc",
38+
deps = [":trace_config_proto"],
39+
)
40+
3141
java_proto_library(
3242
name = "trace_proto_java",
3343
deps = [":trace_proto"],
3444
)
45+
46+
java_proto_library(
47+
name = "trace_config_proto_java",
48+
deps = [":trace_config_proto"],
49+
)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2018, OpenCensus Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package opencensus.proto.trace;
18+
19+
option java_multiple_files = true;
20+
option java_package = "io.opencensus.proto.trace";
21+
option java_outer_classname = "TraceConfigProto";
22+
23+
option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/traceconfigproto";
24+
25+
// Global configuration of the trace service.
26+
message TraceConfig {
27+
28+
// The global default sampler used to make decisions on span sampling.
29+
oneof sampler {
30+
ProbabilitySampler probability_sampler = 1;
31+
32+
ConstantSampler constant_sampler = 2;
33+
34+
RateLimitingSampler rate_limiting_sampler = 3;
35+
}
36+
37+
// TODO(songya): add more fields.
38+
}
39+
40+
// Sampler that tries to uniformly sample traces with a given probability.
41+
// The probability of sampling a trace is equal to that of the specified probability.
42+
message ProbabilitySampler {
43+
44+
// The desired probability of sampling. Must be within [0.0, 1.0].
45+
double samplingProbability = 1;
46+
}
47+
48+
// Sampler that makes a constant decision (either always "yes" or always "no")
49+
// on span sampling.
50+
message ConstantSampler {
51+
52+
// Whether spans should be always sampled, or never sampled.
53+
bool decision = 1;
54+
}
55+
56+
// Sampler that tries to sample with a rate per time window.
57+
message RateLimitingSampler {
58+
59+
// Rate per second.
60+
int64 qps = 1;
61+
}

0 commit comments

Comments
 (0)