/*
 * #%L
 * servo
 * %%
 * Copyright (C) 2011 - 2012 Netflix
 * %%
 * 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.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package com.netflix.servo.tag;

/**
 * Keeps track of tags that should be applied to counters incremented in the
 * current thread. Can be used to customize the context for code executed in
 * a particular thread. For example, on a server with a thread per request the
 * context can be set so metrics will be tagged accordingly.
 */
public final class ThreadLocalTaggingContext implements TaggingContext {

    private final ThreadLocal<TagList> context = new ThreadLocal<TagList>();

    public ThreadLocalTaggingContext() {
    }

    /** Set the tags to be associated with the current thread. */
    public void setTags(TagList tags) {
        context.set(tags);
    }

    /** Get the tags associated with the current thread. */
    @Override
    public TagList getTags() {
        return context.get();
    }

    /** Remove the tags associated with the current thread. */
    public void reset() {
        context.remove();
    }
}

@@ -1119,21 +1119,239 @@
 ;%0A%0A    p
-ublic
+rivate static final ThreadLocalTaggingContext INSTANCE = new ThreadLocalTaggingContext();%0A%0A    /** Get the instance. */%0A    public static ThreadLocalTaggingContext getInstance() %7B%0A        return INSTANCE;%0A    %7D%0A%0A    private
  ThreadL

make thread local context a singleton