Lines Matching defs:template

61         // Read the config template from the resoures.
63 byte[] template = null;
67 template = new byte[inputStream.available()];
68 inputStream.read(template);
69 templateProto = StatsdConfig.parseFrom(template);
71 Log.e(TAG, "Unable to read or parse loadtest config template. Using an empty config.");
75 Log.d(TAG, "Loadtest template config: " + mTemplate);
81 * All configs are based on the same template.
82 * That template is designed to make the most use of the set of atoms that {@code SequencePusher}
89 * If the config template has n metrics, the generated config will have n * replication
168 * Creates an {@link EventMetric} based on the template. Makes sure that all names are appended
171 private void addEventMetric(EventMetric template, int suffix, StatsdConfig.Builder config) {
172 EventMetric.Builder metric = template.toBuilder()
173 .setId(template.getId() + suffix)
174 .setWhat(template.getWhat() + suffix);
175 if (template.hasCondition()) {
176 metric.setCondition(template.getCondition() + suffix);
178 if (template.getLinksCount() > 0) {
179 List<MetricConditionLink> links = getLinks(template.getLinksList(), suffix);
187 * Creates a {@link CountMetric} based on the template. Makes sure that all names are appended
190 private void addCountMetric(CountMetric template, int suffix, TimeUnit bucket,
192 CountMetric.Builder metric = template.toBuilder()
193 .setId(template.getId() + suffix)
194 .setWhat(template.getWhat() + suffix);
195 if (template.hasCondition()) {
196 metric.setCondition(template.getCondition() + suffix);
198 if (template.getLinksCount() > 0) {
199 List<MetricConditionLink> links = getLinks(template.getLinksList(), suffix);
208 * Creates a {@link DurationMetric} based on the template. Makes sure that all names are appended
211 private void addDurationMetric(DurationMetric template, int suffix, TimeUnit bucket,
213 DurationMetric.Builder metric = template.toBuilder()
214 .setId(template.getId() + suffix)
215 .setWhat(template.getWhat() + suffix);
216 if (template.hasCondition()) {
217 metric.setCondition(template.getCondition() + suffix);
219 if (template.getLinksCount() > 0) {
220 List<MetricConditionLink> links = getLinks(template.getLinksList(), suffix);
229 * Creates a {@link GaugeMetric} based on the template. Makes sure that all names are appended
232 private void addGaugeMetric(GaugeMetric template, int suffix, TimeUnit bucket,
234 GaugeMetric.Builder metric = template.toBuilder()
235 .setId(template.getId() + suffix)
236 .setWhat(template.getWhat() + suffix);
237 if (template.hasCondition()) {
238 metric.setCondition(template.getCondition() + suffix);
240 if (template.getLinksCount() > 0) {
241 List<MetricConditionLink> links = getLinks(template.getLinksList(), suffix);
250 * Creates a {@link ValueMetric} based on the template. Makes sure that all names are appended
253 private void addValueMetric(ValueMetric template, int suffix, TimeUnit bucket,
255 ValueMetric.Builder metric = template.toBuilder()
256 .setId(template.getId() + suffix)
257 .setWhat(template.getWhat() + suffix);
258 if (template.hasCondition()) {
259 metric.setCondition(template.getCondition() + suffix);
261 if (template.getLinksCount() > 0) {
262 List<MetricConditionLink> links = getLinks(template.getLinksList(), suffix);
271 * Creates a {@link Predicate} based on the template. Makes sure that all names
274 private void addPredicate(Predicate template, int suffix, StatsdConfig.Builder config) {
275 Predicate.Builder predicate = template.toBuilder()
276 .setId(template.getId() + suffix);
277 if (template.hasCombination()) {
278 Predicate.Combination.Builder cb = template.getCombination().toBuilder()
280 for (long child : template.getCombination().getPredicateList()) {
285 if (template.hasSimplePredicate()) {
286 SimplePredicate.Builder sc = template.getSimplePredicate().toBuilder()
287 .setStart(template.getSimplePredicate().getStart() + suffix)
288 .setStop(template.getSimplePredicate().getStop() + suffix);
289 if (template.getSimplePredicate().hasStopAll()) {
290 sc.setStopAll(template.getSimplePredicate().getStopAll() + suffix);
298 * Creates a {@link AtomMatcher} based on the template. Makes sure that all names
301 private void addMatcher(AtomMatcher template, int suffix, StatsdConfig.Builder config) {
302 AtomMatcher.Builder matcher = template.toBuilder()
303 .setId(template.getId() + suffix);
304 if (template.hasCombination()) {
305 AtomMatcher.Combination.Builder cb = template.getCombination().toBuilder()
307 for (long child : template.getCombination().getMatcherList()) {