|
| 1 | +// Copyright (c) 2018 The Jaeger 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 | +package builder |
| 16 | + |
| 17 | +import ( |
| 18 | + "flag" |
| 19 | + "fmt" |
| 20 | + "strconv" |
| 21 | +) |
| 22 | + |
| 23 | +const ( |
| 24 | + // EncodingJSON indicates spans are encoded as a json byte array |
| 25 | + EncodingJSON = "json" |
| 26 | + // EncodingProto indicates spans are encoded as a protobuf byte array |
| 27 | + EncodingProto = "protobuf" |
| 28 | + |
| 29 | + // ConfigPrefix is a prefix fro the ingester flags |
| 30 | + ConfigPrefix = "ingester" |
| 31 | + // SuffixBrokers is a suffix for the brokers flag |
| 32 | + SuffixBrokers = ".brokers" |
| 33 | + // SuffixTopic is a suffix for the topic flag |
| 34 | + SuffixTopic = ".topic" |
| 35 | + // SuffixGroupID is a suffix for the group-id flag |
| 36 | + SuffixGroupID = ".group-id" |
| 37 | + // SuffixParallelism is a suffix for the parallelism flag |
| 38 | + SuffixParallelism = ".parallelism" |
| 39 | + // SuffixEncoding is a suffix for the encoding flag |
| 40 | + SuffixEncoding = ".encoding" |
| 41 | + |
| 42 | + // DefaultBroker is the default kafka broker |
| 43 | + DefaultBroker = "127.0.0.1:9092" |
| 44 | + // DefaultTopic is the default kafka topic |
| 45 | + DefaultTopic = "jaeger-spans" |
| 46 | + // DefaultGroupID is the default consumer Group ID |
| 47 | + DefaultGroupID = "jaeger-ingester" |
| 48 | + // DefaultParallelism is the default parallelism for the span processor |
| 49 | + DefaultParallelism = 1000 |
| 50 | + // DefaultEncoding is the default span encoding |
| 51 | + DefaultEncoding = EncodingProto |
| 52 | +) |
| 53 | + |
| 54 | +// AddFlags adds flags for Builder |
| 55 | +func AddFlags(flagSet *flag.FlagSet) { |
| 56 | + flagSet.String( |
| 57 | + ConfigPrefix+SuffixBrokers, |
| 58 | + DefaultBroker, |
| 59 | + "The comma-separated list of kafka brokers. i.e. '127.0.0.1:9092,0.0.0:1234'") |
| 60 | + flagSet.String( |
| 61 | + ConfigPrefix+SuffixTopic, |
| 62 | + DefaultTopic, |
| 63 | + "The name of the kafka topic to consume from") |
| 64 | + flagSet.String( |
| 65 | + ConfigPrefix+SuffixGroupID, |
| 66 | + DefaultGroupID, |
| 67 | + "The Consumer Group that ingester will be consuming on behalf of") |
| 68 | + flagSet.String( |
| 69 | + ConfigPrefix+SuffixParallelism, |
| 70 | + strconv.Itoa(DefaultParallelism), |
| 71 | + "The number of messages to process in parallel") |
| 72 | + flagSet.String( |
| 73 | + ConfigPrefix+SuffixEncoding, |
| 74 | + DefaultEncoding, |
| 75 | + fmt.Sprintf(`The encoding of spans ("%s" or "%s") consumed from kafka`, EncodingProto, EncodingJSON)) |
| 76 | +} |
0 commit comments