All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gobblin.metrics.Taggable Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2014-2016 LinkedIn Corp. All rights reserved.
 *
 * 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.
 */

package gobblin.metrics;

import java.util.Collection;
import java.util.List;


/**
 * An interface for classes with which {@link Tag}s can be associated.
 *
 * @author Yinan Li
 */
public interface Taggable {

  /**
   * Add a single {@link Tag}.
   *
   * 

* The order in which {@link Tag}s are added is important as this is the order * the tag names appear in the metric name prefix. *

* * @param tag the {@link Tag} to add */ public void addTag(Tag tag); /** * Add a collection of {@link Tag}s. * * @param tags the collection of {@link Tag}s to add */ public void addTags(Collection> tags); /** * Get all {@link Tag}s in a list. * *

* This method guarantees no duplicated {@link Tag}s and the order of {@link Tag}s * is the same as the one in which the {@link Tag}s were added. *

* * @return all {@link Tag}s in a list */ public List> getTags(); /** * Construct a metric name prefix from the {@link Tag}s. * *

* The prefix will include both the key and value of every {@link Tag} in the form of {@code key:value} * if {@code includeTagKeys} is {@code true}, otherwise it only includes the value of every {@link Tag}. *

* * @param includeTagKeys whether to include tag keys in the metric name prefix * @return a metric name prefix constructed from the {@link Tag}s */ public String metricNamePrefix(boolean includeTagKeys); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy