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
15syntax = "proto3";
16
17package opencensus.proto.trace.v1;
18
19option java_multiple_files = true;
20option java_package = "io.opencensus.proto.trace.v1";
21option java_outer_classname = "TraceConfigProto";
22
23option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1";
24
25option ruby_package = "OpenCensus.Proto.Trace.V1";
26
27// Global configuration of the trace service. All fields must be specified, or
28// the default (zero) values will be used for each type.
29message TraceConfig {
30
31  // The global default sampler used to make decisions on span sampling.
32  oneof sampler {
33    ProbabilitySampler probability_sampler = 1;
34
35    ConstantSampler constant_sampler = 2;
36
37    RateLimitingSampler rate_limiting_sampler = 3;
38  }
39
40  // The global default max number of attributes per span.
41  int64 max_number_of_attributes = 4;
42
43  // The global default max number of annotation events per span.
44  int64 max_number_of_annotations = 5;
45
46  // The global default max number of message events per span.
47  int64 max_number_of_message_events = 6;
48
49  // The global default max number of link entries per span.
50  int64 max_number_of_links = 7;
51}
52
53// Sampler that tries to uniformly sample traces with a given probability.
54// The probability of sampling a trace is equal to that of the specified probability.
55message ProbabilitySampler {
56
57  // The desired probability of sampling. Must be within [0.0, 1.0].
58  double samplingProbability = 1;
59}
60
61// Sampler that always makes a constant decision on span sampling.
62message ConstantSampler {
63
64  // How spans should be sampled:
65  // - Always off
66  // - Always on
67  // - Always follow the parent Span's decision (off if no parent).
68  enum ConstantDecision {
69    ALWAYS_OFF = 0;
70    ALWAYS_ON = 1;
71    ALWAYS_PARENT = 2;
72  }
73  ConstantDecision decision = 1;
74}
75
76// Sampler that tries to sample with a rate per time window.
77message RateLimitingSampler {
78
79  // Rate per second.
80  int64 qps = 1;
81}
82