id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
28,600
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/PatternUtils.java
PatternUtils.ignoreCase
static Matcher ignoreCase(Matcher matcher) { if (matcher instanceof CharClassMatcher) { CharClassMatcher m = matcher.as(); return new CharClassMatcher(m.set(), true); } else if (matcher instanceof CharSeqMatcher) { CharSeqMatcher m = matcher.as(); return new CharSeqMatcher(m.pattern(), t...
java
static Matcher ignoreCase(Matcher matcher) { if (matcher instanceof CharClassMatcher) { CharClassMatcher m = matcher.as(); return new CharClassMatcher(m.set(), true); } else if (matcher instanceof CharSeqMatcher) { CharSeqMatcher m = matcher.as(); return new CharSeqMatcher(m.pattern(), t...
[ "static", "Matcher", "ignoreCase", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "CharClassMatcher", ")", "{", "CharClassMatcher", "m", "=", "matcher", ".", "as", "(", ")", ";", "return", "new", "CharClassMatcher", "(", "m", ".", ...
Convert to a matchers that ignores the case.
[ "Convert", "to", "a", "matchers", "that", "ignores", "the", "case", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/PatternUtils.java#L192-L208
28,601
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/PatternUtils.java
PatternUtils.head
static Matcher head(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> ms = matcher.<SeqMatcher>as().matchers(); return ms.get(0); } else { return matcher; } }
java
static Matcher head(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> ms = matcher.<SeqMatcher>as().matchers(); return ms.get(0); } else { return matcher; } }
[ "static", "Matcher", "head", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "SeqMatcher", ")", "{", "List", "<", "Matcher", ">", "ms", "=", "matcher", ".", "<", "SeqMatcher", ">", "as", "(", ")", ".", "matchers", "(", ")", "...
Returns the first matcher from a sequence.
[ "Returns", "the", "first", "matcher", "from", "a", "sequence", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/PatternUtils.java#L211-L218
28,602
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/PatternUtils.java
PatternUtils.tail
static Matcher tail(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> ms = matcher.<SeqMatcher>as().matchers(); return SeqMatcher.create(ms.subList(1, ms.size())); } else { return TrueMatcher.INSTANCE; } }
java
static Matcher tail(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> ms = matcher.<SeqMatcher>as().matchers(); return SeqMatcher.create(ms.subList(1, ms.size())); } else { return TrueMatcher.INSTANCE; } }
[ "static", "Matcher", "tail", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "SeqMatcher", ")", "{", "List", "<", "Matcher", ">", "ms", "=", "matcher", ".", "<", "SeqMatcher", ">", "as", "(", ")", ".", "matchers", "(", ")", "...
Returns all but the first matcher from a sequence or True if there is only a single matcher in the sequence.
[ "Returns", "all", "but", "the", "first", "matcher", "from", "a", "sequence", "or", "True", "if", "there", "is", "only", "a", "single", "matcher", "in", "the", "sequence", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/PatternUtils.java#L224-L231
28,603
Netflix/spectator
spectator-ext-placeholders/src/main/java/com/netflix/spectator/placeholders/DefaultPlaceholderId.java
DefaultPlaceholderId.createWithFactories
static DefaultPlaceholderId createWithFactories(String name, Iterable<TagFactory> tagFactories, Registry registry) { if (tagFactories == null) { return new DefaultPlaceholderId(name, registry); } else { FactorySorterAndDeduplicator sorter = new FactorySorterAndDeduplicator(tagFactories); retu...
java
static DefaultPlaceholderId createWithFactories(String name, Iterable<TagFactory> tagFactories, Registry registry) { if (tagFactories == null) { return new DefaultPlaceholderId(name, registry); } else { FactorySorterAndDeduplicator sorter = new FactorySorterAndDeduplicator(tagFactories); retu...
[ "static", "DefaultPlaceholderId", "createWithFactories", "(", "String", "name", ",", "Iterable", "<", "TagFactory", ">", "tagFactories", ",", "Registry", "registry", ")", "{", "if", "(", "tagFactories", "==", "null", ")", "{", "return", "new", "DefaultPlaceholderI...
Creates a new id with the specified name and collection of factories. @param name the name of the new id @param tagFactories the possibly empty collection of factories to be attached to the new id @param registry the registry to use when resolving to an {@link Id} @return the newly created id
[ "Creates", "a", "new", "id", "with", "the", "specified", "name", "and", "collection", "of", "factories", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-placeholders/src/main/java/com/netflix/spectator/placeholders/DefaultPlaceholderId.java#L94-L102
28,604
Netflix/spectator
spectator-ext-placeholders/src/main/java/com/netflix/spectator/placeholders/DefaultPlaceholderId.java
DefaultPlaceholderId.createNewId
private DefaultPlaceholderId createNewId(Consumer<FactorySorterAndDeduplicator> consumer) { FactorySorterAndDeduplicator sorter = new FactorySorterAndDeduplicator(tagFactories); consumer.accept(sorter); return new DefaultPlaceholderId(name, sorter.asCollection(), registry); }
java
private DefaultPlaceholderId createNewId(Consumer<FactorySorterAndDeduplicator> consumer) { FactorySorterAndDeduplicator sorter = new FactorySorterAndDeduplicator(tagFactories); consumer.accept(sorter); return new DefaultPlaceholderId(name, sorter.asCollection(), registry); }
[ "private", "DefaultPlaceholderId", "createNewId", "(", "Consumer", "<", "FactorySorterAndDeduplicator", ">", "consumer", ")", "{", "FactorySorterAndDeduplicator", "sorter", "=", "new", "FactorySorterAndDeduplicator", "(", "tagFactories", ")", ";", "consumer", ".", "accept...
Creates a new dynamic id based on the factories associated with this id and whatever additions are made by the specified consumer. @param consumer lambda that can update the sorter with additional tag factories @return the newly created id
[ "Creates", "a", "new", "dynamic", "id", "based", "on", "the", "factories", "associated", "with", "this", "id", "and", "whatever", "additions", "are", "made", "by", "the", "specified", "consumer", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-placeholders/src/main/java/com/netflix/spectator/placeholders/DefaultPlaceholderId.java#L210-L215
28,605
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/Utils.java
Utils.getMethod
static Method getMethod(Class<?> cls, String name) throws NoSuchMethodException { NoSuchMethodException firstExc = null; for (Class<?> c = cls; c != null; c = c.getSuperclass()) { try { return c.getDeclaredMethod(name); } catch (NoSuchMethodException e) { if (firstExc == null) { ...
java
static Method getMethod(Class<?> cls, String name) throws NoSuchMethodException { NoSuchMethodException firstExc = null; for (Class<?> c = cls; c != null; c = c.getSuperclass()) { try { return c.getDeclaredMethod(name); } catch (NoSuchMethodException e) { if (firstExc == null) { ...
[ "static", "Method", "getMethod", "(", "Class", "<", "?", ">", "cls", ",", "String", "name", ")", "throws", "NoSuchMethodException", "{", "NoSuchMethodException", "firstExc", "=", "null", ";", "for", "(", "Class", "<", "?", ">", "c", "=", "cls", ";", "c",...
Search for a method in the class and all superclasses.
[ "Search", "for", "a", "method", "in", "the", "class", "and", "all", "superclasses", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L42-L54
28,606
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/Utils.java
Utils.getGaugeMethod
static Method getGaugeMethod(Registry registry, Id id, Object obj, String method) { try { final Method m = Utils.getMethod(obj.getClass(), method); try { // Make sure we can cast the response to a Number final Number n = (Number) m.invoke(obj); REGISTRY_LOGGER.debug( ...
java
static Method getGaugeMethod(Registry registry, Id id, Object obj, String method) { try { final Method m = Utils.getMethod(obj.getClass(), method); try { // Make sure we can cast the response to a Number final Number n = (Number) m.invoke(obj); REGISTRY_LOGGER.debug( ...
[ "static", "Method", "getGaugeMethod", "(", "Registry", "registry", ",", "Id", "id", ",", "Object", "obj", ",", "String", "method", ")", "{", "try", "{", "final", "Method", "m", "=", "Utils", ".", "getMethod", "(", "obj", ".", "getClass", "(", ")", ",",...
Return a method supplying a value for a gauge.
[ "Return", "a", "method", "supplying", "a", "value", "for", "a", "gauge", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L57-L77
28,607
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/Utils.java
Utils.normalize
public static Id normalize(Id id) { return (new DefaultId(id.name())).withTags(id.tags()).normalize(); }
java
public static Id normalize(Id id) { return (new DefaultId(id.name())).withTags(id.tags()).normalize(); }
[ "public", "static", "Id", "normalize", "(", "Id", "id", ")", "{", "return", "(", "new", "DefaultId", "(", "id", ".", "name", "(", ")", ")", ")", ".", "withTags", "(", "id", ".", "tags", "(", ")", ")", ".", "normalize", "(", ")", ";", "}" ]
Returns a new id with the tag list sorted by key and with no duplicate keys.
[ "Returns", "a", "new", "id", "with", "the", "tag", "list", "sorted", "by", "key", "and", "with", "no", "duplicate", "keys", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L82-L84
28,608
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/Utils.java
Utils.first
public static Measurement first(Iterable<Measurement> ms, Predicate<Measurement> p) { Iterator<Measurement> it = filter(ms, p).iterator(); return it.hasNext() ? it.next() : null; }
java
public static Measurement first(Iterable<Measurement> ms, Predicate<Measurement> p) { Iterator<Measurement> it = filter(ms, p).iterator(); return it.hasNext() ? it.next() : null; }
[ "public", "static", "Measurement", "first", "(", "Iterable", "<", "Measurement", ">", "ms", ",", "Predicate", "<", "Measurement", ">", "p", ")", "{", "Iterator", "<", "Measurement", ">", "it", "=", "filter", "(", "ms", ",", "p", ")", ".", "iterator", "...
Returns the first measurement that matches the predicate. @param ms A set of measurements. @param p Predicate to use for selecting values. @return Measurement or null if no matches are found.
[ "Returns", "the", "first", "measurement", "that", "matches", "the", "predicate", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L164-L167
28,609
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/Utils.java
Utils.toList
public static <T> List<T> toList(Iterable<T> iter) { List<T> buf = new ArrayList<>(); for (T v : iter) { buf.add(v); } return buf; }
java
public static <T> List<T> toList(Iterable<T> iter) { List<T> buf = new ArrayList<>(); for (T v : iter) { buf.add(v); } return buf; }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "toList", "(", "Iterable", "<", "T", ">", "iter", ")", "{", "List", "<", "T", ">", "buf", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "T", "v", ":", "iter", ")", "{", "...
Returns a list with a copy of the data from the iterable.
[ "Returns", "a", "list", "with", "a", "copy", "of", "the", "data", "from", "the", "iterable", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L218-L224
28,610
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/Utils.java
Utils.toList
public static <T> List<T> toList(Iterator<T> iter) { List<T> buf = new ArrayList<>(); while (iter.hasNext()) { buf.add(iter.next()); } return buf; }
java
public static <T> List<T> toList(Iterator<T> iter) { List<T> buf = new ArrayList<>(); while (iter.hasNext()) { buf.add(iter.next()); } return buf; }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "toList", "(", "Iterator", "<", "T", ">", "iter", ")", "{", "List", "<", "T", ">", "buf", "=", "new", "ArrayList", "<>", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ...
Returns a list with the data from the iterator.
[ "Returns", "a", "list", "with", "the", "data", "from", "the", "iterator", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L229-L235
28,611
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/Utils.java
Utils.size
@SuppressWarnings("PMD.UnusedLocalVariable") public static <T> int size(Iterable<T> iter) { if (iter instanceof ArrayTagSet) { return ((ArrayTagSet) iter).size(); } else if (iter instanceof Collection<?>) { return ((Collection<?>) iter).size(); } else { int size = 0; for (T v : ite...
java
@SuppressWarnings("PMD.UnusedLocalVariable") public static <T> int size(Iterable<T> iter) { if (iter instanceof ArrayTagSet) { return ((ArrayTagSet) iter).size(); } else if (iter instanceof Collection<?>) { return ((Collection<?>) iter).size(); } else { int size = 0; for (T v : ite...
[ "@", "SuppressWarnings", "(", "\"PMD.UnusedLocalVariable\"", ")", "public", "static", "<", "T", ">", "int", "size", "(", "Iterable", "<", "T", ">", "iter", ")", "{", "if", "(", "iter", "instanceof", "ArrayTagSet", ")", "{", "return", "(", "(", "ArrayTagSet...
Returns the size of an iterable. This method should only be used with fixed size collections. It will attempt to find an efficient method to get the size before falling back to a traversal of the iterable.
[ "Returns", "the", "size", "of", "an", "iterable", ".", "This", "method", "should", "only", "be", "used", "with", "fixed", "size", "collections", ".", "It", "will", "attempt", "to", "find", "an", "efficient", "method", "to", "get", "the", "size", "before", ...
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L242-L255
28,612
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/Utils.java
Utils.toIterable
static Iterable<Tag> toIterable(String[] tags) { if (tags.length % 2 == 1) { throw new IllegalArgumentException("size must be even, it is a set of key=value pairs"); } ArrayList<Tag> ts = new ArrayList<>(tags.length / 2); for (int i = 0; i < tags.length; i += 2) { ts.add(new BasicTag(tags[i]...
java
static Iterable<Tag> toIterable(String[] tags) { if (tags.length % 2 == 1) { throw new IllegalArgumentException("size must be even, it is a set of key=value pairs"); } ArrayList<Tag> ts = new ArrayList<>(tags.length / 2); for (int i = 0; i < tags.length; i += 2) { ts.add(new BasicTag(tags[i]...
[ "static", "Iterable", "<", "Tag", ">", "toIterable", "(", "String", "[", "]", "tags", ")", "{", "if", "(", "tags", ".", "length", "%", "2", "==", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"size must be even, it is a set of key=value pai...
Returns an iterable of tags based on a string array.
[ "Returns", "an", "iterable", "of", "tags", "based", "on", "a", "string", "array", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L260-L269
28,613
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/Utils.java
Utils.propagateTypeError
public static void propagateTypeError( Registry registry, Id id, Class<?> desiredClass, Class<?> actualClass) { final String dType = desiredClass.getName(); final String aType = actualClass.getName(); final String msg = String.format("cannot access '%s' as a %s, it already exists as a %s", id,...
java
public static void propagateTypeError( Registry registry, Id id, Class<?> desiredClass, Class<?> actualClass) { final String dType = desiredClass.getName(); final String aType = actualClass.getName(); final String msg = String.format("cannot access '%s' as a %s, it already exists as a %s", id,...
[ "public", "static", "void", "propagateTypeError", "(", "Registry", "registry", ",", "Id", "id", ",", "Class", "<", "?", ">", "desiredClass", ",", "Class", "<", "?", ">", "actualClass", ")", "{", "final", "String", "dType", "=", "desiredClass", ".", "getNam...
Propagate a type error exception. Used in situations where an existing id has already been registered but with a different class.
[ "Propagate", "a", "type", "error", "exception", ".", "Used", "in", "situations", "where", "an", "existing", "id", "has", "already", "been", "registered", "but", "with", "a", "different", "class", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L294-L301
28,614
Netflix/spectator
spectator-ext-log4j2/src/main/java/com/netflix/spectator/log4j/SpectatorAppender.java
SpectatorAppender.addToRootLogger
public static void addToRootLogger( Registry registry, String name, boolean ignoreExceptions) { final Appender appender = new SpectatorAppender(registry, name, null, null, ignoreExceptions); appender.start(); LoggerContext context = (LoggerContext) LogManager.getContext(false); Config...
java
public static void addToRootLogger( Registry registry, String name, boolean ignoreExceptions) { final Appender appender = new SpectatorAppender(registry, name, null, null, ignoreExceptions); appender.start(); LoggerContext context = (LoggerContext) LogManager.getContext(false); Config...
[ "public", "static", "void", "addToRootLogger", "(", "Registry", "registry", ",", "String", "name", ",", "boolean", "ignoreExceptions", ")", "{", "final", "Appender", "appender", "=", "new", "SpectatorAppender", "(", "registry", ",", "name", ",", "null", ",", "...
Add the spectator appender to the root logger. This method is intended to be called once as part of the applications initialization process. @param registry Spectator registry to use for the appender. @param name Name for the appender. @param ignoreExceptions If set to true then the stack trace metrics are disabled.
[ "Add", "the", "spectator", "appender", "to", "the", "root", "logger", ".", "This", "method", "is", "intended", "to", "be", "called", "once", "as", "part", "of", "the", "applications", "initialization", "process", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-log4j2/src/main/java/com/netflix/spectator/log4j/SpectatorAppender.java#L65-L77
28,615
Netflix/spectator
spectator-ext-log4j2/src/main/java/com/netflix/spectator/log4j/SpectatorAppender.java
SpectatorAppender.createAppender
@PluginFactory public static SpectatorAppender createAppender( @PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filters") Filter filter) { if (name == null) ...
java
@PluginFactory public static SpectatorAppender createAppender( @PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filters") Filter filter) { if (name == null) ...
[ "@", "PluginFactory", "public", "static", "SpectatorAppender", "createAppender", "(", "@", "PluginAttribute", "(", "\"name\"", ")", "String", "name", ",", "@", "PluginAttribute", "(", "\"ignoreExceptions\"", ")", "boolean", "ignoreExceptions", ",", "@", "PluginElement...
Create a new instance of the appender using the global spectator registry.
[ "Create", "a", "new", "instance", "of", "the", "appender", "using", "the", "global", "spectator", "registry", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-log4j2/src/main/java/com/netflix/spectator/log4j/SpectatorAppender.java#L97-L110
28,616
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/patterns/LongTaskTimer.java
LongTaskTimer.get
public static LongTaskTimer get(Registry registry, Id id) { ConcurrentMap<Id, Object> state = registry.state(); Object obj = Utils.computeIfAbsent(state, id, i -> { LongTaskTimer timer = new LongTaskTimer(registry, id); PolledMeter.using(registry) .withId(id) .withTag(Statistic.a...
java
public static LongTaskTimer get(Registry registry, Id id) { ConcurrentMap<Id, Object> state = registry.state(); Object obj = Utils.computeIfAbsent(state, id, i -> { LongTaskTimer timer = new LongTaskTimer(registry, id); PolledMeter.using(registry) .withId(id) .withTag(Statistic.a...
[ "public", "static", "LongTaskTimer", "get", "(", "Registry", "registry", ",", "Id", "id", ")", "{", "ConcurrentMap", "<", "Id", ",", "Object", ">", "state", "=", "registry", ".", "state", "(", ")", ";", "Object", "obj", "=", "Utils", ".", "computeIfAbsen...
Creates a timer for tracking long running tasks. @param registry Registry to use. @param id Identifier for the metric being registered. @return Timer instance.
[ "Creates", "a", "timer", "for", "tracking", "long", "running", "tasks", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/patterns/LongTaskTimer.java#L50-L69
28,617
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/SubscriptionManager.java
SubscriptionManager.refresh
void refresh() { // Request latest expressions from the server try { HttpResponse res = client.get(uri) .withConnectTimeout(connectTimeout) .withReadTimeout(readTimeout) .addHeader("If-None-Match", etag) .send() .decompress(); if (res.status() == 304...
java
void refresh() { // Request latest expressions from the server try { HttpResponse res = client.get(uri) .withConnectTimeout(connectTimeout) .withReadTimeout(readTimeout) .addHeader("If-None-Match", etag) .send() .decompress(); if (res.status() == 304...
[ "void", "refresh", "(", ")", "{", "// Request latest expressions from the server", "try", "{", "HttpResponse", "res", "=", "client", ".", "get", "(", "uri", ")", ".", "withConnectTimeout", "(", "connectTimeout", ")", ".", "withReadTimeout", "(", "readTimeout", ")"...
Refresh the subscriptions from the server.
[ "Refresh", "the", "subscriptions", "from", "the", "server", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/SubscriptionManager.java#L74-L101
28,618
Netflix/spectator
spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/JmxData.java
JmxData.mkString
@SuppressWarnings("PMD.AvoidCatchingThrowable") static String mkString(Object obj) { if (obj == null) { return "null"; } try { return obj.toString() + " (type is " + obj.getClass() + ")"; } catch (Throwable t) { return t.getClass().toString() + ": " + t.getMessage() + " (type is " + ...
java
@SuppressWarnings("PMD.AvoidCatchingThrowable") static String mkString(Object obj) { if (obj == null) { return "null"; } try { return obj.toString() + " (type is " + obj.getClass() + ")"; } catch (Throwable t) { return t.getClass().toString() + ": " + t.getMessage() + " (type is " + ...
[ "@", "SuppressWarnings", "(", "\"PMD.AvoidCatchingThrowable\"", ")", "static", "String", "mkString", "(", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "\"null\"", ";", "}", "try", "{", "return", "obj", ".", "toString", "("...
Convert object to string and checking if it fails.
[ "Convert", "object", "to", "string", "and", "checking", "if", "it", "fails", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/JmxData.java#L56-L66
28,619
Netflix/spectator
spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java
HelperFunctions.getGcType
static GcType getGcType(String name) { GcType t = KNOWN_COLLECTOR_NAMES.get(name); return (t == null) ? GcType.UNKNOWN : t; }
java
static GcType getGcType(String name) { GcType t = KNOWN_COLLECTOR_NAMES.get(name); return (t == null) ? GcType.UNKNOWN : t; }
[ "static", "GcType", "getGcType", "(", "String", "name", ")", "{", "GcType", "t", "=", "KNOWN_COLLECTOR_NAMES", ".", "get", "(", "name", ")", ";", "return", "(", "t", "==", "null", ")", "?", "GcType", ".", "UNKNOWN", ":", "t", ";", "}" ]
Determine the type, old or young, based on the name of the collector.
[ "Determine", "the", "type", "old", "or", "young", "based", "on", "the", "name", "of", "the", "collector", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java#L47-L50
28,620
Netflix/spectator
spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java
HelperFunctions.getTotalUsage
static long getTotalUsage(Map<String, MemoryUsage> usages) { long sum = 0L; for (Map.Entry<String, MemoryUsage> e : usages.entrySet()) { sum += e.getValue().getUsed(); } return sum; }
java
static long getTotalUsage(Map<String, MemoryUsage> usages) { long sum = 0L; for (Map.Entry<String, MemoryUsage> e : usages.entrySet()) { sum += e.getValue().getUsed(); } return sum; }
[ "static", "long", "getTotalUsage", "(", "Map", "<", "String", ",", "MemoryUsage", ">", "usages", ")", "{", "long", "sum", "=", "0L", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "MemoryUsage", ">", "e", ":", "usages", ".", "entrySet", "(...
Compute the total usage across all pools.
[ "Compute", "the", "total", "usage", "across", "all", "pools", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java#L63-L69
28,621
Netflix/spectator
spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java
HelperFunctions.getTotalMaxUsage
static long getTotalMaxUsage(Map<String, MemoryUsage> usages) { long sum = 0L; for (Map.Entry<String, MemoryUsage> e : usages.entrySet()) { long max = e.getValue().getMax(); if (max > 0) { sum += e.getValue().getMax(); } } return sum; }
java
static long getTotalMaxUsage(Map<String, MemoryUsage> usages) { long sum = 0L; for (Map.Entry<String, MemoryUsage> e : usages.entrySet()) { long max = e.getValue().getMax(); if (max > 0) { sum += e.getValue().getMax(); } } return sum; }
[ "static", "long", "getTotalMaxUsage", "(", "Map", "<", "String", ",", "MemoryUsage", ">", "usages", ")", "{", "long", "sum", "=", "0L", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "MemoryUsage", ">", "e", ":", "usages", ".", "entrySet", ...
Compute the max usage across all pools.
[ "Compute", "the", "max", "usage", "across", "all", "pools", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java#L72-L81
28,622
Netflix/spectator
spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java
HelperFunctions.getPromotionSize
static long getPromotionSize(GcInfo info) { long totalBefore = getTotalUsage(info.getMemoryUsageBeforeGc()); long totalAfter = getTotalUsage(info.getMemoryUsageAfterGc()); return totalAfter - totalBefore; }
java
static long getPromotionSize(GcInfo info) { long totalBefore = getTotalUsage(info.getMemoryUsageBeforeGc()); long totalAfter = getTotalUsage(info.getMemoryUsageAfterGc()); return totalAfter - totalBefore; }
[ "static", "long", "getPromotionSize", "(", "GcInfo", "info", ")", "{", "long", "totalBefore", "=", "getTotalUsage", "(", "info", ".", "getMemoryUsageBeforeGc", "(", ")", ")", ";", "long", "totalAfter", "=", "getTotalUsage", "(", "info", ".", "getMemoryUsageAfter...
Compute the amount of data promoted during a GC event.
[ "Compute", "the", "amount", "of", "data", "promoted", "during", "a", "GC", "event", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/HelperFunctions.java#L84-L88
28,623
Netflix/spectator
spectator-reg-servo/src/main/java/com/netflix/spectator/servo/StepLong.java
StepLong.addAndGet
void addAndGet(long amount) { for (int i = 0; i < ServoPollers.NUM_POLLERS; ++i) { getCurrent(i).addAndGet(amount); } }
java
void addAndGet(long amount) { for (int i = 0; i < ServoPollers.NUM_POLLERS; ++i) { getCurrent(i).addAndGet(amount); } }
[ "void", "addAndGet", "(", "long", "amount", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ServoPollers", ".", "NUM_POLLERS", ";", "++", "i", ")", "{", "getCurrent", "(", "i", ")", ".", "addAndGet", "(", "amount", ")", ";", "}", "}" ...
Add to the current bucket.
[ "Add", "to", "the", "current", "bucket", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-servo/src/main/java/com/netflix/spectator/servo/StepLong.java#L59-L63
28,624
Netflix/spectator
spectator-reg-servo/src/main/java/com/netflix/spectator/servo/StepLong.java
StepLong.getCurrent
AtomicLong getCurrent(int pollerIndex) { rollCount(pollerIndex, clock.now()); return data[2 * pollerIndex + CURRENT]; }
java
AtomicLong getCurrent(int pollerIndex) { rollCount(pollerIndex, clock.now()); return data[2 * pollerIndex + CURRENT]; }
[ "AtomicLong", "getCurrent", "(", "int", "pollerIndex", ")", "{", "rollCount", "(", "pollerIndex", ",", "clock", ".", "now", "(", ")", ")", ";", "return", "data", "[", "2", "*", "pollerIndex", "+", "CURRENT", "]", ";", "}" ]
Get the AtomicLong for the current bucket.
[ "Get", "the", "AtomicLong", "for", "the", "current", "bucket", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-servo/src/main/java/com/netflix/spectator/servo/StepLong.java#L77-L80
28,625
Netflix/spectator
spectator-reg-servo/src/main/java/com/netflix/spectator/servo/StepLong.java
StepLong.poll
Long poll(int pollerIndex) { final long now = clock.now(); final long step = ServoPollers.POLLING_INTERVALS[pollerIndex]; rollCount(pollerIndex, now); final int prevPos = 2 * pollerIndex + PREVIOUS; final long value = data[prevPos].get(); final long last = lastPollTime[pollerIndex].getAndSet(n...
java
Long poll(int pollerIndex) { final long now = clock.now(); final long step = ServoPollers.POLLING_INTERVALS[pollerIndex]; rollCount(pollerIndex, now); final int prevPos = 2 * pollerIndex + PREVIOUS; final long value = data[prevPos].get(); final long last = lastPollTime[pollerIndex].getAndSet(n...
[ "Long", "poll", "(", "int", "pollerIndex", ")", "{", "final", "long", "now", "=", "clock", ".", "now", "(", ")", ";", "final", "long", "step", "=", "ServoPollers", ".", "POLLING_INTERVALS", "[", "pollerIndex", "]", ";", "rollCount", "(", "pollerIndex", "...
Get the value for the last completed interval.
[ "Get", "the", "value", "for", "the", "last", "completed", "interval", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-servo/src/main/java/com/netflix/spectator/servo/StepLong.java#L83-L101
28,626
Netflix/spectator
spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/MappingExpr.java
MappingExpr.substitute
static String substitute(String pattern, Map<String, String> vars) { String value = pattern; for (Map.Entry<String, String> entry : vars.entrySet()) { String raw = entry.getValue(); String v = Introspector.decapitalize(raw); value = value.replace("{raw:" + entry.getKey() + "}", raw); val...
java
static String substitute(String pattern, Map<String, String> vars) { String value = pattern; for (Map.Entry<String, String> entry : vars.entrySet()) { String raw = entry.getValue(); String v = Introspector.decapitalize(raw); value = value.replace("{raw:" + entry.getKey() + "}", raw); val...
[ "static", "String", "substitute", "(", "String", "pattern", ",", "Map", "<", "String", ",", "String", ">", "vars", ")", "{", "String", "value", "=", "pattern", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "va...
Substitute named variables in the pattern string with the corresponding values in the variables map. @param pattern Pattern string with placeholders, name surounded by curly braces, e.g.: {@code {variable name}}. @param vars Map of variable substitutions that are available. @return String with values substituted in. I...
[ "Substitute", "named", "variables", "in", "the", "pattern", "string", "with", "the", "corresponding", "values", "in", "the", "variables", "map", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/MappingExpr.java#L45-L54
28,627
Netflix/spectator
spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/MappingExpr.java
MappingExpr.eval
@SuppressWarnings("PMD") static Double eval(String expr, Map<String, ? extends Number> vars) { Deque<Double> stack = new ArrayDeque<>(); String[] parts = expr.split("[,\\s]+"); for (String part : parts) { switch (part) { case ":add": binaryOp(stack, (a, b) -> a + b); break; ca...
java
@SuppressWarnings("PMD") static Double eval(String expr, Map<String, ? extends Number> vars) { Deque<Double> stack = new ArrayDeque<>(); String[] parts = expr.split("[,\\s]+"); for (String part : parts) { switch (part) { case ":add": binaryOp(stack, (a, b) -> a + b); break; ca...
[ "@", "SuppressWarnings", "(", "\"PMD\"", ")", "static", "Double", "eval", "(", "String", "expr", ",", "Map", "<", "String", ",", "?", "extends", "Number", ">", "vars", ")", "{", "Deque", "<", "Double", ">", "stack", "=", "new", "ArrayDeque", "<>", "(",...
Evaluate a simple stack expression for the value. @param expr Basic stack expression that supports placeholders, numeric constants, and basic binary operations (:add, :sub, :mul, :div). @param vars Map of variable substitutions that are available. @return Double value for the expression. If the expression cannot be ev...
[ "Evaluate", "a", "simple", "stack", "expression", "for", "the", "value", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/MappingExpr.java#L68-L91
28,628
Netflix/spectator
spectator-reg-stateless/src/main/java/com/netflix/spectator/stateless/StatelessRegistry.java
StatelessRegistry.stop
public void stop() { if (scheduler != null) { scheduler.shutdown(); scheduler = null; logger.info("flushing metrics before stopping the registry"); collectData(); logger.info("stopped collecting metrics every {} reporting to {}", frequency, uri); } else { logger.warn("registr...
java
public void stop() { if (scheduler != null) { scheduler.shutdown(); scheduler = null; logger.info("flushing metrics before stopping the registry"); collectData(); logger.info("stopped collecting metrics every {} reporting to {}", frequency, uri); } else { logger.warn("registr...
[ "public", "void", "stop", "(", ")", "{", "if", "(", "scheduler", "!=", "null", ")", "{", "scheduler", ".", "shutdown", "(", ")", ";", "scheduler", "=", "null", ";", "logger", ".", "info", "(", "\"flushing metrics before stopping the registry\"", ")", ";", ...
Stop the scheduler reporting data.
[ "Stop", "the", "scheduler", "reporting", "data", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-stateless/src/main/java/com/netflix/spectator/stateless/StatelessRegistry.java#L103-L113
28,629
Netflix/spectator
spectator-reg-servo/src/main/java/com/netflix/spectator/servo/ServoRegistry.java
ServoRegistry.toMonitorConfig
MonitorConfig toMonitorConfig(Id id, Tag stat) { MonitorConfig.Builder builder = new MonitorConfig.Builder(id.name()); if (stat != null) { builder.withTag(stat.key(), stat.value()); } for (Tag t : id.tags()) { builder.withTag(t.key(), t.value()); } return builder.build(); }
java
MonitorConfig toMonitorConfig(Id id, Tag stat) { MonitorConfig.Builder builder = new MonitorConfig.Builder(id.name()); if (stat != null) { builder.withTag(stat.key(), stat.value()); } for (Tag t : id.tags()) { builder.withTag(t.key(), t.value()); } return builder.build(); }
[ "MonitorConfig", "toMonitorConfig", "(", "Id", "id", ",", "Tag", "stat", ")", "{", "MonitorConfig", ".", "Builder", "builder", "=", "new", "MonitorConfig", ".", "Builder", "(", "id", ".", "name", "(", ")", ")", ";", "if", "(", "stat", "!=", "null", ")"...
Converts a spectator id into a MonitorConfig that can be used by servo.
[ "Converts", "a", "spectator", "id", "into", "a", "MonitorConfig", "that", "can", "be", "used", "by", "servo", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-servo/src/main/java/com/netflix/spectator/servo/ServoRegistry.java#L95-L104
28,630
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java
HttpLogEntry.logClientRequest
@Deprecated public static void logClientRequest(Logger logger, HttpLogEntry entry) { log(logger, CLIENT, entry); }
java
@Deprecated public static void logClientRequest(Logger logger, HttpLogEntry entry) { log(logger, CLIENT, entry); }
[ "@", "Deprecated", "public", "static", "void", "logClientRequest", "(", "Logger", "logger", ",", "HttpLogEntry", "entry", ")", "{", "log", "(", "logger", ",", "CLIENT", ",", "entry", ")", ";", "}" ]
Log a client request. @deprecated Use {@link #logClientRequest(HttpLogEntry)} instead.
[ "Log", "a", "client", "request", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L111-L114
28,631
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java
HttpLogEntry.logServerRequest
@Deprecated public static void logServerRequest(Logger logger, HttpLogEntry entry) { log(logger, SERVER, entry); }
java
@Deprecated public static void logServerRequest(Logger logger, HttpLogEntry entry) { log(logger, SERVER, entry); }
[ "@", "Deprecated", "public", "static", "void", "logServerRequest", "(", "Logger", "logger", ",", "HttpLogEntry", "entry", ")", "{", "log", "(", "logger", ",", "SERVER", ",", "entry", ")", ";", "}" ]
Log a request received by a server. @deprecated Use {@link #logServerRequest(HttpLogEntry)} instead.
[ "Log", "a", "request", "received", "by", "a", "server", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L125-L128
28,632
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java
HttpLogEntry.withRequestUri
public HttpLogEntry withRequestUri(String uri, String path) { this.requestUri = uri; this.path = path; return this; }
java
public HttpLogEntry withRequestUri(String uri, String path) { this.requestUri = uri; this.path = path; return this; }
[ "public", "HttpLogEntry", "withRequestUri", "(", "String", "uri", ",", "String", "path", ")", "{", "this", ".", "requestUri", "=", "uri", ";", "this", ".", "path", "=", "path", ";", "return", "this", ";", "}" ]
Set the URI for the actual http request.
[ "Set", "the", "URI", "for", "the", "actual", "http", "request", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L259-L263
28,633
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java
HttpLogEntry.withRequestHeader
public HttpLogEntry withRequestHeader(String name, String value) { requestHeaders.add(new Header(name, value)); return this; }
java
public HttpLogEntry withRequestHeader(String name, String value) { requestHeaders.add(new Header(name, value)); return this; }
[ "public", "HttpLogEntry", "withRequestHeader", "(", "String", "name", ",", "String", "value", ")", "{", "requestHeaders", ".", "add", "(", "new", "Header", "(", "name", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Add a header that was on the request.
[ "Add", "a", "header", "that", "was", "on", "the", "request", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L277-L280
28,634
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java
HttpLogEntry.withResponseHeader
public HttpLogEntry withResponseHeader(String name, String value) { responseHeaders.add(new Header(name, value)); return this; }
java
public HttpLogEntry withResponseHeader(String name, String value) { responseHeaders.add(new Header(name, value)); return this; }
[ "public", "HttpLogEntry", "withResponseHeader", "(", "String", "name", ",", "String", "value", ")", "{", "responseHeaders", ".", "add", "(", "new", "Header", "(", "name", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Add a header that was on the response.
[ "Add", "a", "header", "that", "was", "on", "the", "response", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L351-L354
28,635
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java
HttpLogEntry.getLatency
public long getLatency() { if (latency >= 0L) { return latency; } else if (events.size() >= 2) { return events.get(events.size() - 1).timestamp() - events.get(0).timestamp(); } else { return -1; } }
java
public long getLatency() { if (latency >= 0L) { return latency; } else if (events.size() >= 2) { return events.get(events.size() - 1).timestamp() - events.get(0).timestamp(); } else { return -1; } }
[ "public", "long", "getLatency", "(", ")", "{", "if", "(", "latency", ">=", "0L", ")", "{", "return", "latency", ";", "}", "else", "if", "(", "events", ".", "size", "(", ")", ">=", "2", ")", "{", "return", "events", ".", "get", "(", "events", ".",...
Return the latency for the request. If not explicitly set it will be calculated from the events.
[ "Return", "the", "latency", "for", "the", "request", ".", "If", "not", "explicitly", "set", "it", "will", "be", "calculated", "from", "the", "events", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L394-L402
28,636
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java
HttpLogEntry.getOverallLatency
public long getOverallLatency() { if (maxAttempts <= 1 || originalStart < 0) { return getLatency(); } else if (events.isEmpty()) { return -1; } else { return events.get(events.size() - 1).timestamp() - originalStart; } }
java
public long getOverallLatency() { if (maxAttempts <= 1 || originalStart < 0) { return getLatency(); } else if (events.isEmpty()) { return -1; } else { return events.get(events.size() - 1).timestamp() - originalStart; } }
[ "public", "long", "getOverallLatency", "(", ")", "{", "if", "(", "maxAttempts", "<=", "1", "||", "originalStart", "<", "0", ")", "{", "return", "getLatency", "(", ")", ";", "}", "else", "if", "(", "events", ".", "isEmpty", "(", ")", ")", "{", "return...
Return the overall latency for a group of requests including all retries.
[ "Return", "the", "overall", "latency", "for", "a", "group", "of", "requests", "including", "all", "retries", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L405-L413
28,637
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java
HttpLogEntry.getStartTime
public String getStartTime() { return events.isEmpty() ? "unknown" : isoDate.format(new Date(events.get(0).timestamp())); }
java
public String getStartTime() { return events.isEmpty() ? "unknown" : isoDate.format(new Date(events.get(0).timestamp())); }
[ "public", "String", "getStartTime", "(", ")", "{", "return", "events", ".", "isEmpty", "(", ")", "?", "\"unknown\"", ":", "isoDate", ".", "format", "(", "new", "Date", "(", "events", ".", "get", "(", "0", ")", ".", "timestamp", "(", ")", ")", ")", ...
Return the starting time for the request.
[ "Return", "the", "starting", "time", "for", "the", "request", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L416-L420
28,638
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java
HttpLogEntry.getTimeline
public String getTimeline() { StringBuilder builder = new StringBuilder(); for (Event event : events) { builder.append(event.name()).append(":").append(event.timestamp()).append(";"); } return builder.toString(); }
java
public String getTimeline() { StringBuilder builder = new StringBuilder(); for (Event event : events) { builder.append(event.name()).append(":").append(event.timestamp()).append(";"); } return builder.toString(); }
[ "public", "String", "getTimeline", "(", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Event", "event", ":", "events", ")", "{", "builder", ".", "append", "(", "event", ".", "name", "(", ")", ")", ".", ...
Return a time line based on marked events.
[ "Return", "a", "time", "line", "based", "on", "marked", "events", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L441-L447
28,639
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpRequestBuilder.java
HttpRequestBuilder.addHeader
public HttpRequestBuilder addHeader(String name, String value) { reqHeaders.put(name, value); entry.withRequestHeader(name, value); return this; }
java
public HttpRequestBuilder addHeader(String name, String value) { reqHeaders.put(name, value); entry.withRequestHeader(name, value); return this; }
[ "public", "HttpRequestBuilder", "addHeader", "(", "String", "name", ",", "String", "value", ")", "{", "reqHeaders", ".", "put", "(", "name", ",", "value", ")", ";", "entry", ".", "withRequestHeader", "(", "name", ",", "value", ")", ";", "return", "this", ...
Add a header to the request. Note the content type will be set automatically when providing the content payload and should not be set here.
[ "Add", "a", "header", "to", "the", "request", ".", "Note", "the", "content", "type", "will", "be", "set", "automatically", "when", "providing", "the", "content", "payload", "and", "should", "not", "be", "set", "here", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpRequestBuilder.java#L81-L85
28,640
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpRequestBuilder.java
HttpRequestBuilder.withContent
public HttpRequestBuilder withContent(String type, String content) { return withContent(type, content.getBytes(StandardCharsets.UTF_8)); }
java
public HttpRequestBuilder withContent(String type, String content) { return withContent(type, content.getBytes(StandardCharsets.UTF_8)); }
[ "public", "HttpRequestBuilder", "withContent", "(", "String", "type", ",", "String", "content", ")", "{", "return", "withContent", "(", "type", ",", "content", ".", "getBytes", "(", "StandardCharsets", ".", "UTF_8", ")", ")", ";", "}" ]
Set the request body.
[ "Set", "the", "request", "body", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpRequestBuilder.java#L130-L132
28,641
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpRequestBuilder.java
HttpRequestBuilder.compress
public HttpRequestBuilder compress(int level) throws IOException { addHeader("Content-Encoding", "gzip"); entity = HttpUtils.gzip(entity, level); return this; }
java
public HttpRequestBuilder compress(int level) throws IOException { addHeader("Content-Encoding", "gzip"); entity = HttpUtils.gzip(entity, level); return this; }
[ "public", "HttpRequestBuilder", "compress", "(", "int", "level", ")", "throws", "IOException", "{", "addHeader", "(", "\"Content-Encoding\"", ",", "\"gzip\"", ")", ";", "entity", "=", "HttpUtils", ".", "gzip", "(", "entity", ",", "level", ")", ";", "return", ...
Compress the request body using the specified compression level. The content must have already been set on the builder.
[ "Compress", "the", "request", "body", "using", "the", "specified", "compression", "level", ".", "The", "content", "must", "have", "already", "been", "set", "on", "the", "builder", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpRequestBuilder.java#L153-L157
28,642
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpRequestBuilder.java
HttpRequestBuilder.withRetries
public HttpRequestBuilder withRetries(int n) { Preconditions.checkArg(n >= 0, "number of retries must be >= 0"); this.numAttempts = n + 1; entry.withMaxAttempts(numAttempts); return this; }
java
public HttpRequestBuilder withRetries(int n) { Preconditions.checkArg(n >= 0, "number of retries must be >= 0"); this.numAttempts = n + 1; entry.withMaxAttempts(numAttempts); return this; }
[ "public", "HttpRequestBuilder", "withRetries", "(", "int", "n", ")", "{", "Preconditions", ".", "checkArg", "(", "n", ">=", "0", ",", "\"number of retries must be >= 0\"", ")", ";", "this", ".", "numAttempts", "=", "n", "+", "1", ";", "entry", ".", "withMaxA...
How many times to retry if the intial attempt fails?
[ "How", "many", "times", "to", "retry", "if", "the", "intial", "attempt", "fails?" ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpRequestBuilder.java#L160-L165
28,643
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileBuckets.java
PercentileBuckets.asArray
public static long[] asArray() { long[] values = new long[BUCKET_VALUES.length]; System.arraycopy(BUCKET_VALUES, 0, values, 0, BUCKET_VALUES.length); return values; }
java
public static long[] asArray() { long[] values = new long[BUCKET_VALUES.length]; System.arraycopy(BUCKET_VALUES, 0, values, 0, BUCKET_VALUES.length); return values; }
[ "public", "static", "long", "[", "]", "asArray", "(", ")", "{", "long", "[", "]", "values", "=", "new", "long", "[", "BUCKET_VALUES", ".", "length", "]", ";", "System", ".", "arraycopy", "(", "BUCKET_VALUES", ",", "0", ",", "values", ",", "0", ",", ...
Returns a copy of the bucket values array.
[ "Returns", "a", "copy", "of", "the", "bucket", "values", "array", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileBuckets.java#L34-L38
28,644
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileBuckets.java
PercentileBuckets.map
public static <T> T[] map(Class<T> c, Function<Long, T> f) { @SuppressWarnings("unchecked") T[] values = (T[]) Array.newInstance(c, BUCKET_VALUES.length); for (int i = 0; i < BUCKET_VALUES.length; ++i) { values[i] = f.apply(BUCKET_VALUES[i]); } return values; }
java
public static <T> T[] map(Class<T> c, Function<Long, T> f) { @SuppressWarnings("unchecked") T[] values = (T[]) Array.newInstance(c, BUCKET_VALUES.length); for (int i = 0; i < BUCKET_VALUES.length; ++i) { values[i] = f.apply(BUCKET_VALUES[i]); } return values; }
[ "public", "static", "<", "T", ">", "T", "[", "]", "map", "(", "Class", "<", "T", ">", "c", ",", "Function", "<", "Long", ",", "T", ">", "f", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "[", "]", "values", "=", "(", "T", ...
Map the bucket values to a new array of a different type.
[ "Map", "the", "bucket", "values", "to", "a", "new", "array", "of", "a", "different", "type", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileBuckets.java#L41-L48
28,645
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileBuckets.java
PercentileBuckets.percentiles
public static void percentiles(long[] counts, double[] pcts, double[] results) { Preconditions.checkArg(counts.length == BUCKET_VALUES.length, "counts is not the same size as buckets array"); Preconditions.checkArg(pcts.length > 0, "pct array cannot be empty"); Preconditions.checkArg(pcts.length == ...
java
public static void percentiles(long[] counts, double[] pcts, double[] results) { Preconditions.checkArg(counts.length == BUCKET_VALUES.length, "counts is not the same size as buckets array"); Preconditions.checkArg(pcts.length > 0, "pct array cannot be empty"); Preconditions.checkArg(pcts.length == ...
[ "public", "static", "void", "percentiles", "(", "long", "[", "]", "counts", ",", "double", "[", "]", "pcts", ",", "double", "[", "]", "results", ")", "{", "Preconditions", ".", "checkArg", "(", "counts", ".", "length", "==", "BUCKET_VALUES", ".", "length...
Compute a set of percentiles based on the counts for the buckets. @param counts Counts for each of the buckets. The size must be the same as {@link #length()} and the positions must correspond to the positions of the bucket values. @param pcts Array with the requested percentile values. The length must be at least 1 a...
[ "Compute", "a", "set", "of", "percentiles", "based", "on", "the", "counts", "for", "the", "buckets", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileBuckets.java#L105-L144
28,646
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileBuckets.java
PercentileBuckets.percentile
public static double percentile(long[] counts, double p) { double[] pcts = new double[] {p}; double[] results = new double[1]; percentiles(counts, pcts, results); return results[0]; }
java
public static double percentile(long[] counts, double p) { double[] pcts = new double[] {p}; double[] results = new double[1]; percentiles(counts, pcts, results); return results[0]; }
[ "public", "static", "double", "percentile", "(", "long", "[", "]", "counts", ",", "double", "p", ")", "{", "double", "[", "]", "pcts", "=", "new", "double", "[", "]", "{", "p", "}", ";", "double", "[", "]", "results", "=", "new", "double", "[", "...
Compute a percentile based on the counts for the buckets. @param counts Counts for each of the buckets. The size must be the same as {@link #length()} and the positions must correspond to the positions of the bucket values. @param p Percentile to compute, the value should be {@code 0.0 <= p <= 100.0}. @return The calc...
[ "Compute", "a", "percentile", "based", "on", "the", "counts", "for", "the", "buckets", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileBuckets.java#L157-L162
28,647
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java
AtlasRegistry.getInitialDelay
long getInitialDelay(long stepSize) { long now = clock().wallTime(); long stepBoundary = now / stepSize * stepSize; // Buffer by 10% of the step interval on either side long offset = stepSize / 10; // Check if the current delay is within the acceptable range long delay = now - stepBoundary; ...
java
long getInitialDelay(long stepSize) { long now = clock().wallTime(); long stepBoundary = now / stepSize * stepSize; // Buffer by 10% of the step interval on either side long offset = stepSize / 10; // Check if the current delay is within the acceptable range long delay = now - stepBoundary; ...
[ "long", "getInitialDelay", "(", "long", "stepSize", ")", "{", "long", "now", "=", "clock", "(", ")", ".", "wallTime", "(", ")", ";", "long", "stepBoundary", "=", "now", "/", "stepSize", "*", "stepSize", ";", "// Buffer by 10% of the step interval on either side"...
Avoid collecting right on boundaries to minimize transitions on step longs during a collection. Randomly distribute across the middle of the step interval.
[ "Avoid", "collecting", "right", "on", "boundaries", "to", "minimize", "transitions", "on", "step", "longs", "during", "a", "collection", ".", "Randomly", "distribute", "across", "the", "middle", "of", "the", "step", "interval", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java#L155-L171
28,648
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java
AtlasRegistry.stop
public void stop() { if (scheduler != null) { scheduler.shutdown(); scheduler = null; logger.info("stopped collecting metrics every {}ms reporting to {}", step, uri); } else { logger.warn("registry stopped, but was never started"); } }
java
public void stop() { if (scheduler != null) { scheduler.shutdown(); scheduler = null; logger.info("stopped collecting metrics every {}ms reporting to {}", step, uri); } else { logger.warn("registry stopped, but was never started"); } }
[ "public", "void", "stop", "(", ")", "{", "if", "(", "scheduler", "!=", "null", ")", "{", "scheduler", ".", "shutdown", "(", ")", ";", "scheduler", "=", "null", ";", "logger", ".", "info", "(", "\"stopped collecting metrics every {}ms reporting to {}\"", ",", ...
Stop the scheduler reporting Atlas data.
[ "Stop", "the", "scheduler", "reporting", "Atlas", "data", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java#L176-L184
28,649
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java
AtlasRegistry.collectData
void collectData() { // Send data for any subscriptions if (config.lwcEnabled()) { try { handleSubscriptions(); } catch (Exception e) { logger.warn("failed to handle subscriptions", e); } } else { logger.debug("lwc is disabled, skipping subscriptions"); } // ...
java
void collectData() { // Send data for any subscriptions if (config.lwcEnabled()) { try { handleSubscriptions(); } catch (Exception e) { logger.warn("failed to handle subscriptions", e); } } else { logger.debug("lwc is disabled, skipping subscriptions"); } // ...
[ "void", "collectData", "(", ")", "{", "// Send data for any subscriptions", "if", "(", "config", ".", "lwcEnabled", "(", ")", ")", "{", "try", "{", "handleSubscriptions", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "warn", ...
Collect data and send to Atlas.
[ "Collect", "data", "and", "send", "to", "Atlas", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java#L187-L224
28,650
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java
AtlasRegistry.recordClockSkew
private void recordClockSkew(long responseTimestamp) { if (responseTimestamp == 0L) { logger.debug("no date timestamp on response, cannot record skew"); } else { final long delta = clock().wallTime() - responseTimestamp; if (delta >= 0L) { // Local clock is running fast compared to the...
java
private void recordClockSkew(long responseTimestamp) { if (responseTimestamp == 0L) { logger.debug("no date timestamp on response, cannot record skew"); } else { final long delta = clock().wallTime() - responseTimestamp; if (delta >= 0L) { // Local clock is running fast compared to the...
[ "private", "void", "recordClockSkew", "(", "long", "responseTimestamp", ")", "{", "if", "(", "responseTimestamp", "==", "0L", ")", "{", "logger", ".", "debug", "(", "\"no date timestamp on response, cannot record skew\"", ")", ";", "}", "else", "{", "final", "long...
Record the difference between the date response time and the local time on the server. This is used to get a rough idea of the amount of skew in the environment. Ideally it should be fairly small. The date header will only have seconds so we expect to regularly have differences of up to 1 second. Note, that it is a rou...
[ "Record", "the", "difference", "between", "the", "date", "response", "time", "and", "the", "local", "time", "on", "the", "server", ".", "This", "is", "used", "to", "get", "a", "rough", "idea", "of", "the", "amount", "of", "skew", "in", "the", "environmen...
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java#L277-L295
28,651
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java
AtlasRegistry.getBatches
List<List<Measurement>> getBatches() { List<List<Measurement>> batches = new ArrayList<>(); List<Measurement> ms = getMeasurements().collect(Collectors.toList()); for (int i = 0; i < ms.size(); i += batchSize) { List<Measurement> batch = ms.subList(i, Math.min(ms.size(), i + batchSize)); batches...
java
List<List<Measurement>> getBatches() { List<List<Measurement>> batches = new ArrayList<>(); List<Measurement> ms = getMeasurements().collect(Collectors.toList()); for (int i = 0; i < ms.size(); i += batchSize) { List<Measurement> batch = ms.subList(i, Math.min(ms.size(), i + batchSize)); batches...
[ "List", "<", "List", "<", "Measurement", ">", ">", "getBatches", "(", ")", "{", "List", "<", "List", "<", "Measurement", ">>", "batches", "=", "new", "ArrayList", "<>", "(", ")", ";", "List", "<", "Measurement", ">", "ms", "=", "getMeasurements", "(", ...
Get a list of all measurements and break them into batches.
[ "Get", "a", "list", "of", "all", "measurements", "and", "break", "them", "into", "batches", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/AtlasRegistry.java#L327-L335
28,652
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.control
public static AsciiSet control() { final boolean[] members = new boolean[128]; for (char c = 0; c < members.length; ++c) { members[c] = Character.isISOControl(c); } return new AsciiSet(members); }
java
public static AsciiSet control() { final boolean[] members = new boolean[128]; for (char c = 0; c < members.length; ++c) { members[c] = Character.isISOControl(c); } return new AsciiSet(members); }
[ "public", "static", "AsciiSet", "control", "(", ")", "{", "final", "boolean", "[", "]", "members", "=", "new", "boolean", "[", "128", "]", ";", "for", "(", "char", "c", "=", "0", ";", "c", "<", "members", ".", "length", ";", "++", "c", ")", "{", ...
Returns a set that matches ascii control characters.
[ "Returns", "a", "set", "that", "matches", "ascii", "control", "characters", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L128-L134
28,653
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.toPattern
private static String toPattern(boolean[] members) { StringBuilder buf = new StringBuilder(); if (members['-']) { buf.append('-'); } boolean previous = false; char s = 0; for (int i = 0; i < members.length; ++i) { if (members[i] && !previous) { s = (char) i; } else if (...
java
private static String toPattern(boolean[] members) { StringBuilder buf = new StringBuilder(); if (members['-']) { buf.append('-'); } boolean previous = false; char s = 0; for (int i = 0; i < members.length; ++i) { if (members[i] && !previous) { s = (char) i; } else if (...
[ "private", "static", "String", "toPattern", "(", "boolean", "[", "]", "members", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "members", "[", "'", "'", "]", ")", "{", "buf", ".", "append", "(", "'", "'", ...
Converts the members array to a pattern string. Used to provide a user friendly toString implementation for the set.
[ "Converts", "the", "members", "array", "to", "a", "pattern", "string", ".", "Used", "to", "provide", "a", "user", "friendly", "toString", "implementation", "for", "the", "set", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L140-L161
28,654
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.containsAll
public boolean containsAll(CharSequence str) { final int n = str.length(); for (int i = 0; i < n; ++i) { if (!contains(str.charAt(i))) { return false; } } return true; }
java
public boolean containsAll(CharSequence str) { final int n = str.length(); for (int i = 0; i < n; ++i) { if (!contains(str.charAt(i))) { return false; } } return true; }
[ "public", "boolean", "containsAll", "(", "CharSequence", "str", ")", "{", "final", "int", "n", "=", "str", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "++", "i", ")", "{", "if", "(", "!", "contains",...
Returns true if all characters in the string are contained within the set.
[ "Returns", "true", "if", "all", "characters", "in", "the", "string", "are", "contained", "within", "the", "set", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L190-L198
28,655
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.replaceNonMembers
public String replaceNonMembers(String input, char replacement) { if (!contains(replacement)) { throw new IllegalArgumentException(replacement + " is not a member of " + pattern); } return containsAll(input) ? input : replaceNonMembersImpl(input, replacement); }
java
public String replaceNonMembers(String input, char replacement) { if (!contains(replacement)) { throw new IllegalArgumentException(replacement + " is not a member of " + pattern); } return containsAll(input) ? input : replaceNonMembersImpl(input, replacement); }
[ "public", "String", "replaceNonMembers", "(", "String", "input", ",", "char", "replacement", ")", "{", "if", "(", "!", "contains", "(", "replacement", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "replacement", "+", "\" is not a member of \"", ...
Replace all characters in the input string with the replacement character.
[ "Replace", "all", "characters", "in", "the", "input", "string", "with", "the", "replacement", "character", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L203-L208
28,656
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.union
public AsciiSet union(AsciiSet set) { final boolean[] unionMembers = new boolean[128]; for (int i = 0; i < unionMembers.length; ++i) { unionMembers[i] = members[i] || set.members[i]; } return new AsciiSet(unionMembers); }
java
public AsciiSet union(AsciiSet set) { final boolean[] unionMembers = new boolean[128]; for (int i = 0; i < unionMembers.length; ++i) { unionMembers[i] = members[i] || set.members[i]; } return new AsciiSet(unionMembers); }
[ "public", "AsciiSet", "union", "(", "AsciiSet", "set", ")", "{", "final", "boolean", "[", "]", "unionMembers", "=", "new", "boolean", "[", "128", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "unionMembers", ".", "length", ";", "++", "...
Returns a new set that will match characters either in the this set or in the set that is provided.
[ "Returns", "a", "new", "set", "that", "will", "match", "characters", "either", "in", "the", "this", "set", "or", "in", "the", "set", "that", "is", "provided", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L214-L220
28,657
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.intersection
public AsciiSet intersection(AsciiSet set) { final boolean[] intersectionMembers = new boolean[128]; for (int i = 0; i < intersectionMembers.length; ++i) { intersectionMembers[i] = members[i] && set.members[i]; } return new AsciiSet(intersectionMembers); }
java
public AsciiSet intersection(AsciiSet set) { final boolean[] intersectionMembers = new boolean[128]; for (int i = 0; i < intersectionMembers.length; ++i) { intersectionMembers[i] = members[i] && set.members[i]; } return new AsciiSet(intersectionMembers); }
[ "public", "AsciiSet", "intersection", "(", "AsciiSet", "set", ")", "{", "final", "boolean", "[", "]", "intersectionMembers", "=", "new", "boolean", "[", "128", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "intersectionMembers", ".", "length...
Returns a new set that will match characters iff they are included this set and in the set that is provided.
[ "Returns", "a", "new", "set", "that", "will", "match", "characters", "iff", "they", "are", "included", "this", "set", "and", "in", "the", "set", "that", "is", "provided", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L226-L232
28,658
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.diff
public AsciiSet diff(AsciiSet set) { final boolean[] diffMembers = new boolean[128]; for (int i = 0; i < diffMembers.length; ++i) { diffMembers[i] = members[i] && !set.members[i]; } return new AsciiSet(diffMembers); }
java
public AsciiSet diff(AsciiSet set) { final boolean[] diffMembers = new boolean[128]; for (int i = 0; i < diffMembers.length; ++i) { diffMembers[i] = members[i] && !set.members[i]; } return new AsciiSet(diffMembers); }
[ "public", "AsciiSet", "diff", "(", "AsciiSet", "set", ")", "{", "final", "boolean", "[", "]", "diffMembers", "=", "new", "boolean", "[", "128", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "diffMembers", ".", "length", ";", "++", "i",...
Returns a new set that will match characters iff they are included this set and not in the set that is provided.
[ "Returns", "a", "new", "set", "that", "will", "match", "characters", "iff", "they", "are", "included", "this", "set", "and", "not", "in", "the", "set", "that", "is", "provided", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L238-L244
28,659
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.invert
public AsciiSet invert() { final boolean[] invertMembers = new boolean[128]; for (int i = 0; i < invertMembers.length; ++i) { invertMembers[i] = !members[i]; } return new AsciiSet(invertMembers); }
java
public AsciiSet invert() { final boolean[] invertMembers = new boolean[128]; for (int i = 0; i < invertMembers.length; ++i) { invertMembers[i] = !members[i]; } return new AsciiSet(invertMembers); }
[ "public", "AsciiSet", "invert", "(", ")", "{", "final", "boolean", "[", "]", "invertMembers", "=", "new", "boolean", "[", "128", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "invertMembers", ".", "length", ";", "++", "i", ")", "{", ...
Returns a new set that will match characters that are not included this set.
[ "Returns", "a", "new", "set", "that", "will", "match", "characters", "that", "are", "not", "included", "this", "set", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L249-L255
28,660
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java
AsciiSet.character
public Optional<Character> character() { char c = 0; int count = 0; for (int i = 0; i < members.length; ++i) { if (members[i]) { c = (char) i; ++count; } } return (count == 1) ? Optional.of(c) : Optional.empty(); }
java
public Optional<Character> character() { char c = 0; int count = 0; for (int i = 0; i < members.length; ++i) { if (members[i]) { c = (char) i; ++count; } } return (count == 1) ? Optional.of(c) : Optional.empty(); }
[ "public", "Optional", "<", "Character", ">", "character", "(", ")", "{", "char", "c", "=", "0", ";", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "members", ".", "length", ";", "++", "i", ")", "{", "if", "("...
If this set matches a single character, then return an optional with that character. Otherwise return an empty optional.
[ "If", "this", "set", "matches", "a", "single", "character", "then", "return", "an", "optional", "with", "that", "character", ".", "Otherwise", "return", "an", "empty", "optional", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L273-L283
28,661
Netflix/spectator
spectator-web-spring/src/main/java/com/netflix/spectator/controllers/filter/PrototypeMeasurementFilterSpecification.java
PrototypeMeasurementFilterSpecification.loadFromPath
public static PrototypeMeasurementFilterSpecification loadFromPath(String path) throws IOException { byte[] jsonData = Files.readAllBytes(Paths.get(path)); ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue( jsonData, PrototypeMeasurementFilterSpecification.class); ...
java
public static PrototypeMeasurementFilterSpecification loadFromPath(String path) throws IOException { byte[] jsonData = Files.readAllBytes(Paths.get(path)); ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue( jsonData, PrototypeMeasurementFilterSpecification.class); ...
[ "public", "static", "PrototypeMeasurementFilterSpecification", "loadFromPath", "(", "String", "path", ")", "throws", "IOException", "{", "byte", "[", "]", "jsonData", "=", "Files", ".", "readAllBytes", "(", "Paths", ".", "get", "(", "path", ")", ")", ";", "Obj...
Loads a specification from a file.
[ "Loads", "a", "specification", "from", "a", "file", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-web-spring/src/main/java/com/netflix/spectator/controllers/filter/PrototypeMeasurementFilterSpecification.java#L202-L208
28,662
Netflix/spectator
spectator-perf/src/main/java/com/netflix/spectator/perf/Main.java
Main.run
public static Registry run(String type, String test) { Registry registry = createRegistry(type); TESTS.get(test).accept(registry); return registry; }
java
public static Registry run(String type, String test) { Registry registry = createRegistry(type); TESTS.get(test).accept(registry); return registry; }
[ "public", "static", "Registry", "run", "(", "String", "type", ",", "String", "test", ")", "{", "Registry", "registry", "=", "createRegistry", "(", "type", ")", ";", "TESTS", ".", "get", "(", "test", ")", ".", "accept", "(", "registry", ")", ";", "retur...
Run a test for a given type of registry. @param type Should be one of `noop`, `default`, `atlas`, or `servo`. @param test Test name to run. See the `TESTS` map for available options.
[ "Run", "a", "test", "for", "a", "given", "type", "of", "registry", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-perf/src/main/java/com/netflix/spectator/perf/Main.java#L78-L82
28,663
Netflix/spectator
spectator-perf/src/main/java/com/netflix/spectator/perf/Main.java
Main.main
@SuppressWarnings("PMD") public static void main(String[] args) { if (args.length < 2) { System.out.println("Usage: perf <registry> <test>"); System.exit(1); } Registry registry = run(args[0], args[1]); GraphLayout igraph = GraphLayout.parseInstance(registry); System.out.println(igra...
java
@SuppressWarnings("PMD") public static void main(String[] args) { if (args.length < 2) { System.out.println("Usage: perf <registry> <test>"); System.exit(1); } Registry registry = run(args[0], args[1]); GraphLayout igraph = GraphLayout.parseInstance(registry); System.out.println(igra...
[ "@", "SuppressWarnings", "(", "\"PMD\"", ")", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", "<", "2", ")", "{", "System", ".", "out", ".", "println", "(", "\"Usage: perf <registry> <test>...
Run a test and output the memory footprint of the registry.
[ "Run", "a", "test", "and", "output", "the", "memory", "footprint", "of", "the", "registry", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-perf/src/main/java/com/netflix/spectator/perf/Main.java#L85-L96
28,664
Netflix/spectator
spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/NetflixHeaders.java
NetflixHeaders.extractFrom
public static Map<String, String> extractFrom(Function<String, String> env) { Map<String, String> headers = new LinkedHashMap<>(); addHeader(headers, env, NetflixHeader.ASG, NETFLIX_ASG); addHeader(headers, env, NetflixHeader.Node, NETFLIX_NODE); addHeader(headers, env, NetflixHeader.Zone, NETFLIX_ZONE)...
java
public static Map<String, String> extractFrom(Function<String, String> env) { Map<String, String> headers = new LinkedHashMap<>(); addHeader(headers, env, NetflixHeader.ASG, NETFLIX_ASG); addHeader(headers, env, NetflixHeader.Node, NETFLIX_NODE); addHeader(headers, env, NetflixHeader.Zone, NETFLIX_ZONE)...
[ "public", "static", "Map", "<", "String", ",", "String", ">", "extractFrom", "(", "Function", "<", "String", ",", "String", ">", "env", ")", "{", "Map", "<", "String", ",", "String", ">", "headers", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "...
Extract common Netflix headers from the specified function for retrieving the value of an environment variable.
[ "Extract", "common", "Netflix", "headers", "from", "the", "specified", "function", "for", "retrieving", "the", "value", "of", "an", "environment", "variable", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/NetflixHeaders.java#L65-L71
28,665
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java
Evaluator.sync
public Evaluator sync(Map<String, List<Subscription>> subs) { Set<String> removed = subscriptions.keySet(); removed.removeAll(subs.keySet()); removed.forEach(this::removeGroupSubscriptions); subs.forEach(this::addGroupSubscriptions); return this; }
java
public Evaluator sync(Map<String, List<Subscription>> subs) { Set<String> removed = subscriptions.keySet(); removed.removeAll(subs.keySet()); removed.forEach(this::removeGroupSubscriptions); subs.forEach(this::addGroupSubscriptions); return this; }
[ "public", "Evaluator", "sync", "(", "Map", "<", "String", ",", "List", "<", "Subscription", ">", ">", "subs", ")", "{", "Set", "<", "String", ">", "removed", "=", "subscriptions", ".", "keySet", "(", ")", ";", "removed", ".", "removeAll", "(", "subs", ...
Synchronize the internal set of subscriptions with the map that is passed in. @param subs Complete set of subscriptions for all groups. The keys for the map are the group names. @return This instance for chaining of update operations.
[ "Synchronize", "the", "internal", "set", "of", "subscriptions", "with", "the", "map", "that", "is", "passed", "in", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java#L50-L56
28,666
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java
Evaluator.addGroupSubscriptions
public Evaluator addGroupSubscriptions(String group, List<Subscription> subs) { List<Subscription> oldSubs = subscriptions.put(group, subs); if (oldSubs == null) { LOGGER.debug("added group {} with {} subscriptions", group, subs.size()); } else { LOGGER.debug("updated group {}, {} subscriptions ...
java
public Evaluator addGroupSubscriptions(String group, List<Subscription> subs) { List<Subscription> oldSubs = subscriptions.put(group, subs); if (oldSubs == null) { LOGGER.debug("added group {} with {} subscriptions", group, subs.size()); } else { LOGGER.debug("updated group {}, {} subscriptions ...
[ "public", "Evaluator", "addGroupSubscriptions", "(", "String", "group", ",", "List", "<", "Subscription", ">", "subs", ")", "{", "List", "<", "Subscription", ">", "oldSubs", "=", "subscriptions", ".", "put", "(", "group", ",", "subs", ")", ";", "if", "(", ...
Add subscriptions for a given group. @param group Name of the group. At Netflix this is typically the cluster that includes the instance reporting data. @param subs Set of subscriptions for the group. @return This instance for chaining of update operations.
[ "Add", "subscriptions", "for", "a", "given", "group", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java#L69-L78
28,667
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java
Evaluator.removeGroupSubscriptions
public Evaluator removeGroupSubscriptions(String group) { List<Subscription> oldSubs = subscriptions.remove(group); if (oldSubs != null) { LOGGER.debug("removed group {} with {} subscriptions", group, oldSubs.size()); } return this; }
java
public Evaluator removeGroupSubscriptions(String group) { List<Subscription> oldSubs = subscriptions.remove(group); if (oldSubs != null) { LOGGER.debug("removed group {} with {} subscriptions", group, oldSubs.size()); } return this; }
[ "public", "Evaluator", "removeGroupSubscriptions", "(", "String", "group", ")", "{", "List", "<", "Subscription", ">", "oldSubs", "=", "subscriptions", ".", "remove", "(", "group", ")", ";", "if", "(", "oldSubs", "!=", "null", ")", "{", "LOGGER", ".", "deb...
Remove subscriptions for a given group. @param group Name of the group. At Netflix this is typically the cluster that includes the instance reporting data. @return This instance for chaining of update operations.
[ "Remove", "subscriptions", "for", "a", "given", "group", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java#L89-L95
28,668
Netflix/spectator
spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java
Evaluator.eval
public EvalPayload eval(String group, long timestamp, List<TagsValuePair> vs) { List<Subscription> subs = subscriptions.getOrDefault(group, Collections.emptyList()); List<EvalPayload.Metric> metrics = new ArrayList<>(); for (Subscription s : subs) { DataExpr expr = s.dataExpr(); for (TagsValuePa...
java
public EvalPayload eval(String group, long timestamp, List<TagsValuePair> vs) { List<Subscription> subs = subscriptions.getOrDefault(group, Collections.emptyList()); List<EvalPayload.Metric> metrics = new ArrayList<>(); for (Subscription s : subs) { DataExpr expr = s.dataExpr(); for (TagsValuePa...
[ "public", "EvalPayload", "eval", "(", "String", "group", ",", "long", "timestamp", ",", "List", "<", "TagsValuePair", ">", "vs", ")", "{", "List", "<", "Subscription", ">", "subs", "=", "subscriptions", ".", "getOrDefault", "(", "group", ",", "Collections", ...
Evaluate expressions for all subscriptions associated with the specified group using the provided data. @param group Name of the group. At Netflix this is typically the cluster that includes the instance reporting data. @param timestamp Timestamp to use for the payload response. @param vs Set of values received for th...
[ "Evaluate", "expressions", "for", "all", "subscriptions", "associated", "with", "the", "specified", "group", "using", "the", "provided", "data", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java#L111-L122
28,669
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/patterns/PolledMeter.java
PolledMeter.update
public static void update(Registry registry) { Iterator<Map.Entry<Id, Object>> iter = registry.state().entrySet().iterator(); while (iter.hasNext()) { Map.Entry<Id, Object> entry = iter.next(); if (entry.getValue() instanceof AbstractMeterState) { AbstractMeterState tuple = (AbstractMeterSta...
java
public static void update(Registry registry) { Iterator<Map.Entry<Id, Object>> iter = registry.state().entrySet().iterator(); while (iter.hasNext()) { Map.Entry<Id, Object> entry = iter.next(); if (entry.getValue() instanceof AbstractMeterState) { AbstractMeterState tuple = (AbstractMeterSta...
[ "public", "static", "void", "update", "(", "Registry", "registry", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "Id", ",", "Object", ">", ">", "iter", "=", "registry", ".", "state", "(", ")", ".", "entrySet", "(", ")", ".", "iterator", "(", ...
Force the polling of all meters associated with the registry.
[ "Force", "the", "polling", "of", "all", "meters", "associated", "with", "the", "registry", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/patterns/PolledMeter.java#L104-L116
28,670
Netflix/spectator
spectator-web-spring/src/main/java/com/netflix/spectator/controllers/filter/PrototypeMeasurementFilter.java
PrototypeMeasurementFilter.metricToPatterns
public IncludeExcludePatterns metricToPatterns(String metric) { IncludeExcludePatterns foundPatterns = metricNameToPatterns.get(metric); if (foundPatterns != null) { return foundPatterns; } // Since the keys in the prototype can be regular expressions, // need to look at all of them and can...
java
public IncludeExcludePatterns metricToPatterns(String metric) { IncludeExcludePatterns foundPatterns = metricNameToPatterns.get(metric); if (foundPatterns != null) { return foundPatterns; } // Since the keys in the prototype can be regular expressions, // need to look at all of them and can...
[ "public", "IncludeExcludePatterns", "metricToPatterns", "(", "String", "metric", ")", "{", "IncludeExcludePatterns", "foundPatterns", "=", "metricNameToPatterns", ".", "get", "(", "metric", ")", ";", "if", "(", "foundPatterns", "!=", "null", ")", "{", "return", "f...
Find the IncludeExcludePatterns for filtering a given metric. The result is the union of all the individual pattern entries where their specified metric name patterns matches the actual metric name.
[ "Find", "the", "IncludeExcludePatterns", "for", "filtering", "a", "given", "metric", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-web-spring/src/main/java/com/netflix/spectator/controllers/filter/PrototypeMeasurementFilter.java#L337-L359
28,671
Netflix/spectator
spectator-web-spring/src/main/java/com/netflix/spectator/controllers/filter/PrototypeMeasurementFilter.java
PrototypeMeasurementFilter.loadFromPath
public static PrototypeMeasurementFilter loadFromPath(String path) throws IOException { PrototypeMeasurementFilterSpecification spec = PrototypeMeasurementFilterSpecification.loadFromPath(path); return new PrototypeMeasurementFilter(spec); }
java
public static PrototypeMeasurementFilter loadFromPath(String path) throws IOException { PrototypeMeasurementFilterSpecification spec = PrototypeMeasurementFilterSpecification.loadFromPath(path); return new PrototypeMeasurementFilter(spec); }
[ "public", "static", "PrototypeMeasurementFilter", "loadFromPath", "(", "String", "path", ")", "throws", "IOException", "{", "PrototypeMeasurementFilterSpecification", "spec", "=", "PrototypeMeasurementFilterSpecification", ".", "loadFromPath", "(", "path", ")", ";", "return...
Factory method building a filter from a specification file.
[ "Factory", "method", "building", "a", "filter", "from", "a", "specification", "file", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-web-spring/src/main/java/com/netflix/spectator/controllers/filter/PrototypeMeasurementFilter.java#L364-L368
28,672
Netflix/spectator
spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/http/HttpRequestBuilder.java
HttpRequestBuilder.addHeader
public HttpRequestBuilder addHeader(String name, String value) { if (value != null) { reqHeaders.put(name, value); } return this; }
java
public HttpRequestBuilder addHeader(String name, String value) { if (value != null) { reqHeaders.put(name, value); } return this; }
[ "public", "HttpRequestBuilder", "addHeader", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "reqHeaders", ".", "put", "(", "name", ",", "value", ")", ";", "}", "return", "this", ";", "}" ]
Add a header to the request. Note the content type will be set automatically when providing the content payload and should not be set here. If the value is null, then the header will get ignored.
[ "Add", "a", "header", "to", "the", "request", ".", "Note", "the", "content", "type", "will", "be", "set", "automatically", "when", "providing", "the", "content", "payload", "and", "should", "not", "be", "set", "here", ".", "If", "the", "value", "is", "nu...
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/http/HttpRequestBuilder.java#L90-L95
28,673
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.optimize
static Matcher optimize(Matcher matcher) { Matcher m = matcher; Matcher opt = optimizeSinglePass(m); for (int i = 0; !m.equals(opt) && i < MAX_ITERATIONS; ++i) { m = opt; opt = optimizeSinglePass(m); } return opt; }
java
static Matcher optimize(Matcher matcher) { Matcher m = matcher; Matcher opt = optimizeSinglePass(m); for (int i = 0; !m.equals(opt) && i < MAX_ITERATIONS; ++i) { m = opt; opt = optimizeSinglePass(m); } return opt; }
[ "static", "Matcher", "optimize", "(", "Matcher", "matcher", ")", "{", "Matcher", "m", "=", "matcher", ";", "Matcher", "opt", "=", "optimizeSinglePass", "(", "m", ")", ";", "for", "(", "int", "i", "=", "0", ";", "!", "m", ".", "equals", "(", "opt", ...
Return a new instance of the matcher that has been optimized.
[ "Return", "a", "new", "instance", "of", "the", "matcher", "that", "has", "been", "optimized", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L38-L46
28,674
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.mergeNext
static Matcher mergeNext(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); List<Matcher> ms = new ArrayList<>(); for (int i = 0; i < matchers.size(); ++i) { Matcher m = matchers.get(i); if (m instanceof GreedyMatch...
java
static Matcher mergeNext(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); List<Matcher> ms = new ArrayList<>(); for (int i = 0; i < matchers.size(); ++i) { Matcher m = matchers.get(i); if (m instanceof GreedyMatch...
[ "static", "Matcher", "mergeNext", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "SeqMatcher", ")", "{", "List", "<", "Matcher", ">", "matchers", "=", "matcher", ".", "<", "SeqMatcher", ">", "as", "(", ")", ".", "matchers", "(",...
For greedy matchers go ahead and include the next portion of the match so it can be checked as we go along. Since there is no support for capturing the value we can stop as soon as it is detected there would be a match rather than finding the largest possible match.
[ "For", "greedy", "matchers", "go", "ahead", "and", "include", "the", "next", "portion", "of", "the", "match", "so", "it", "can", "be", "checked", "as", "we", "go", "along", ".", "Since", "there", "is", "no", "support", "for", "capturing", "the", "value",...
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L83-L100
28,675
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.removeTrueInSequence
static Matcher removeTrueInSequence(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); List<Matcher> ms = new ArrayList<>(); for (Matcher m : matchers) { if (!(m instanceof TrueMatcher)) { ms.add(m); } ...
java
static Matcher removeTrueInSequence(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); List<Matcher> ms = new ArrayList<>(); for (Matcher m : matchers) { if (!(m instanceof TrueMatcher)) { ms.add(m); } ...
[ "static", "Matcher", "removeTrueInSequence", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "SeqMatcher", ")", "{", "List", "<", "Matcher", ">", "matchers", "=", "matcher", ".", "<", "SeqMatcher", ">", "as", "(", ")", ".", "matche...
The true matcher is sometimes used as a placeholder while parsing. For sequences it isn't needed and it is faster to leave them out.
[ "The", "true", "matcher", "is", "sometimes", "used", "as", "a", "placeholder", "while", "parsing", ".", "For", "sequences", "it", "isn", "t", "needed", "and", "it", "is", "faster", "to", "leave", "them", "out", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L106-L118
28,676
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.sequenceWithFalseIsFalse
static Matcher sequenceWithFalseIsFalse(Matcher matcher) { if (matcher instanceof SeqMatcher) { for (Matcher m : matcher.<SeqMatcher>as().matchers()) { if (m instanceof FalseMatcher) { return FalseMatcher.INSTANCE; } } } return matcher; }
java
static Matcher sequenceWithFalseIsFalse(Matcher matcher) { if (matcher instanceof SeqMatcher) { for (Matcher m : matcher.<SeqMatcher>as().matchers()) { if (m instanceof FalseMatcher) { return FalseMatcher.INSTANCE; } } } return matcher; }
[ "static", "Matcher", "sequenceWithFalseIsFalse", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "SeqMatcher", ")", "{", "for", "(", "Matcher", "m", ":", "matcher", ".", "<", "SeqMatcher", ">", "as", "(", ")", ".", "matchers", "(",...
If a sequence contains an explicit false matcher then the whole sequence will never match and can be treated as false.
[ "If", "a", "sequence", "contains", "an", "explicit", "false", "matcher", "then", "the", "whole", "sequence", "will", "never", "match", "and", "can", "be", "treated", "as", "false", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L124-L133
28,677
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.sequenceWithStuffAfterEndIsFalse
static Matcher sequenceWithStuffAfterEndIsFalse(Matcher matcher) { if (matcher instanceof SeqMatcher) { boolean end = false; for (Matcher m : matcher.<SeqMatcher>as().matchers()) { if (m instanceof EndMatcher) { end = true; } else if (end && !m.alwaysMatches()) { retu...
java
static Matcher sequenceWithStuffAfterEndIsFalse(Matcher matcher) { if (matcher instanceof SeqMatcher) { boolean end = false; for (Matcher m : matcher.<SeqMatcher>as().matchers()) { if (m instanceof EndMatcher) { end = true; } else if (end && !m.alwaysMatches()) { retu...
[ "static", "Matcher", "sequenceWithStuffAfterEndIsFalse", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "SeqMatcher", ")", "{", "boolean", "end", "=", "false", ";", "for", "(", "Matcher", "m", ":", "matcher", ".", "<", "SeqMatcher", ...
If a sequence contains content after an end anchor then it will never be able to match and can be treated as false.
[ "If", "a", "sequence", "contains", "content", "after", "an", "end", "anchor", "then", "it", "will", "never", "be", "able", "to", "match", "and", "can", "be", "treated", "as", "false", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L139-L151
28,678
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.convertEmptyCharClassToFalse
static Matcher convertEmptyCharClassToFalse(Matcher matcher) { if (matcher instanceof CharClassMatcher) { return matcher.<CharClassMatcher>as().set().isEmpty() ? FalseMatcher.INSTANCE : matcher; } return matcher; }
java
static Matcher convertEmptyCharClassToFalse(Matcher matcher) { if (matcher instanceof CharClassMatcher) { return matcher.<CharClassMatcher>as().set().isEmpty() ? FalseMatcher.INSTANCE : matcher; } return matcher; }
[ "static", "Matcher", "convertEmptyCharClassToFalse", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "CharClassMatcher", ")", "{", "return", "matcher", ".", "<", "CharClassMatcher", ">", "as", "(", ")", ".", "set", "(", ")", ".", "is...
If a character class is empty, then it will not match anything and can be treated as false.
[ "If", "a", "character", "class", "is", "empty", "then", "it", "will", "not", "match", "anything", "and", "can", "be", "treated", "as", "false", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L171-L178
28,679
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.inlineMatchAnyPrecedingOr
static Matcher inlineMatchAnyPrecedingOr(Matcher matcher) { if (matcher instanceof ZeroOrMoreMatcher) { ZeroOrMoreMatcher zm = matcher.as(); if (zm.repeated() instanceof AnyMatcher && zm.next() instanceof OrMatcher) { List<Matcher> matchers = zm.next().<OrMatcher>as().matchers(); List<Ma...
java
static Matcher inlineMatchAnyPrecedingOr(Matcher matcher) { if (matcher instanceof ZeroOrMoreMatcher) { ZeroOrMoreMatcher zm = matcher.as(); if (zm.repeated() instanceof AnyMatcher && zm.next() instanceof OrMatcher) { List<Matcher> matchers = zm.next().<OrMatcher>as().matchers(); List<Ma...
[ "static", "Matcher", "inlineMatchAnyPrecedingOr", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "ZeroOrMoreMatcher", ")", "{", "ZeroOrMoreMatcher", "zm", "=", "matcher", ".", "as", "(", ")", ";", "if", "(", "zm", ".", "repeated", "...
If the matcher preceding an OR clause is a repeated any match, move into each branch of the OR clause. This allows for other optimizations such as conversion to an indexOf to take effect for each branch.
[ "If", "the", "matcher", "preceding", "an", "OR", "clause", "is", "a", "repeated", "any", "match", "move", "into", "each", "branch", "of", "the", "OR", "clause", ".", "This", "allows", "for", "other", "optimizations", "such", "as", "conversion", "to", "an",...
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L378-L391
28,680
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.startsWithCharSeq
static Matcher startsWithCharSeq(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); if (matchers.size() >= 2 && matchers.get(0) instanceof StartMatcher && matchers.get(1) instanceof CharSeqMatcher) { List<Matc...
java
static Matcher startsWithCharSeq(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); if (matchers.size() >= 2 && matchers.get(0) instanceof StartMatcher && matchers.get(1) instanceof CharSeqMatcher) { List<Matc...
[ "static", "Matcher", "startsWithCharSeq", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "SeqMatcher", ")", "{", "List", "<", "Matcher", ">", "matchers", "=", "matcher", ".", "<", "SeqMatcher", ">", "as", "(", ")", ".", "matchers"...
If the matcher has a start anchored character sequence, then replace it with a StartsWithMatcher. In a tight loop this is much faster than a running with a sequence of two matchers.
[ "If", "the", "matcher", "has", "a", "start", "anchored", "character", "sequence", "then", "replace", "it", "with", "a", "StartsWithMatcher", ".", "In", "a", "tight", "loop", "this", "is", "much", "faster", "than", "a", "running", "with", "a", "sequence", "...
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L398-L411
28,681
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.combineCharSeqAfterStartsWith
static Matcher combineCharSeqAfterStartsWith(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); if (matchers.size() >= 2 && matchers.get(0) instanceof StartsWithMatcher && matchers.get(1) instanceof CharSeqMatcher) { ...
java
static Matcher combineCharSeqAfterStartsWith(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); if (matchers.size() >= 2 && matchers.get(0) instanceof StartsWithMatcher && matchers.get(1) instanceof CharSeqMatcher) { ...
[ "static", "Matcher", "combineCharSeqAfterStartsWith", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "SeqMatcher", ")", "{", "List", "<", "Matcher", ">", "matchers", "=", "matcher", ".", "<", "SeqMatcher", ">", "as", "(", ")", ".", ...
If a char sequence is adjacent to a starts with matcher, then append the sequence to the prefix pattern of the starts with matcher.
[ "If", "a", "char", "sequence", "is", "adjacent", "to", "a", "starts", "with", "matcher", "then", "append", "the", "sequence", "to", "the", "prefix", "pattern", "of", "the", "starts", "with", "matcher", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L417-L434
28,682
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.combineCharSeqAfterIndexOf
static Matcher combineCharSeqAfterIndexOf(Matcher matcher) { if (matcher instanceof IndexOfMatcher) { IndexOfMatcher m = matcher.as(); Matcher next = PatternUtils.head(m.next()); if (next instanceof CharSeqMatcher) { String pattern = m.pattern() + next.<CharSeqMatcher>as().pattern(); ...
java
static Matcher combineCharSeqAfterIndexOf(Matcher matcher) { if (matcher instanceof IndexOfMatcher) { IndexOfMatcher m = matcher.as(); Matcher next = PatternUtils.head(m.next()); if (next instanceof CharSeqMatcher) { String pattern = m.pattern() + next.<CharSeqMatcher>as().pattern(); ...
[ "static", "Matcher", "combineCharSeqAfterIndexOf", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "IndexOfMatcher", ")", "{", "IndexOfMatcher", "m", "=", "matcher", ".", "as", "(", ")", ";", "Matcher", "next", "=", "PatternUtils", "."...
If a char sequence is adjacent to an index of matcher, then append the sequence to the pattern of the index of matcher.
[ "If", "a", "char", "sequence", "is", "adjacent", "to", "an", "index", "of", "matcher", "then", "append", "the", "sequence", "to", "the", "pattern", "of", "the", "index", "of", "matcher", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L440-L450
28,683
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.combineAdjacentCharSeqs
static Matcher combineAdjacentCharSeqs(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); List<Matcher> ms = new ArrayList<>(); CharSeqMatcher cs1 = null; for (Matcher m : matchers) { if (m instanceof CharSeqMatcher) ...
java
static Matcher combineAdjacentCharSeqs(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); List<Matcher> ms = new ArrayList<>(); CharSeqMatcher cs1 = null; for (Matcher m : matchers) { if (m instanceof CharSeqMatcher) ...
[ "static", "Matcher", "combineAdjacentCharSeqs", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "SeqMatcher", ")", "{", "List", "<", "Matcher", ">", "matchers", "=", "matcher", ".", "<", "SeqMatcher", ">", "as", "(", ")", ".", "mat...
If a char sequence is adjacent to another char sequence, then concatenate the sequences.
[ "If", "a", "char", "sequence", "is", "adjacent", "to", "another", "char", "sequence", "then", "concatenate", "the", "sequences", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L455-L482
28,684
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.removeRepeatedStart
static Matcher removeRepeatedStart(Matcher matcher) { if (matcher instanceof ZeroOrMoreMatcher) { ZeroOrMoreMatcher zm = matcher.as(); if (zm.repeated() instanceof StartMatcher) { return zm.next(); } } return matcher; }
java
static Matcher removeRepeatedStart(Matcher matcher) { if (matcher instanceof ZeroOrMoreMatcher) { ZeroOrMoreMatcher zm = matcher.as(); if (zm.repeated() instanceof StartMatcher) { return zm.next(); } } return matcher; }
[ "static", "Matcher", "removeRepeatedStart", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "ZeroOrMoreMatcher", ")", "{", "ZeroOrMoreMatcher", "zm", "=", "matcher", ".", "as", "(", ")", ";", "if", "(", "zm", ".", "repeated", "(", ...
Zero or more start anchors is the same as not being anchored by the start.
[ "Zero", "or", "more", "start", "anchors", "is", "the", "same", "as", "not", "being", "anchored", "by", "the", "start", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L505-L513
28,685
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java
Optimizer.combineAdjacentStart
static Matcher combineAdjacentStart(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); if (!matchers.isEmpty() && matchers.get(0) instanceof StartMatcher) { List<Matcher> ms = new ArrayList<>(); ms.add(StartMatcher.INSTAN...
java
static Matcher combineAdjacentStart(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); if (!matchers.isEmpty() && matchers.get(0) instanceof StartMatcher) { List<Matcher> ms = new ArrayList<>(); ms.add(StartMatcher.INSTAN...
[ "static", "Matcher", "combineAdjacentStart", "(", "Matcher", "matcher", ")", "{", "if", "(", "matcher", "instanceof", "SeqMatcher", ")", "{", "List", "<", "Matcher", ">", "matchers", "=", "matcher", ".", "<", "SeqMatcher", ">", "as", "(", ")", ".", "matche...
Multiple adjacent start anchors can be reduced to a single start anchor.
[ "Multiple", "adjacent", "start", "anchors", "can", "be", "reduced", "to", "a", "single", "start", "anchor", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/matcher/Optimizer.java#L518-L537
28,686
Netflix/spectator
spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java
MetricsController.getDefaultMeasurementFilter
public Predicate<Measurement> getDefaultMeasurementFilter() throws IOException { if (defaultMeasurementFilter != null) { return defaultMeasurementFilter; } if (!prototypeFilterPath.isEmpty()) { defaultMeasurementFilter = PrototypeMeasurementFilter.loadFromPath( prototypeFilterPath); ...
java
public Predicate<Measurement> getDefaultMeasurementFilter() throws IOException { if (defaultMeasurementFilter != null) { return defaultMeasurementFilter; } if (!prototypeFilterPath.isEmpty()) { defaultMeasurementFilter = PrototypeMeasurementFilter.loadFromPath( prototypeFilterPath); ...
[ "public", "Predicate", "<", "Measurement", ">", "getDefaultMeasurementFilter", "(", ")", "throws", "IOException", "{", "if", "(", "defaultMeasurementFilter", "!=", "null", ")", "{", "return", "defaultMeasurementFilter", ";", "}", "if", "(", "!", "prototypeFilterPath...
The default measurement filter is configured through properties.
[ "The", "default", "measurement", "filter", "is", "configured", "through", "properties", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java#L76-L89
28,687
Netflix/spectator
spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java
MetricsController.encodeRegistry
Map<String, MetricValues> encodeRegistry( Registry sourceRegistry, Predicate<Measurement> filter) { Map<String, MetricValues> metricMap = new HashMap<>(); /* * Flatten the meter measurements into a map of measurements keyed by * the name and mapped to the different tag variants. */ f...
java
Map<String, MetricValues> encodeRegistry( Registry sourceRegistry, Predicate<Measurement> filter) { Map<String, MetricValues> metricMap = new HashMap<>(); /* * Flatten the meter measurements into a map of measurements keyed by * the name and mapped to the different tag variants. */ f...
[ "Map", "<", "String", ",", "MetricValues", ">", "encodeRegistry", "(", "Registry", "sourceRegistry", ",", "Predicate", "<", "Measurement", ">", "filter", ")", "{", "Map", "<", "String", ",", "MetricValues", ">", "metricMap", "=", "new", "HashMap", "<>", "(",...
Internal API for encoding a registry that can be encoded as JSON. This is a helper function for the REST endpoint and to test against.
[ "Internal", "API", "for", "encoding", "a", "registry", "that", "can", "be", "encoded", "as", "JSON", ".", "This", "is", "a", "helper", "function", "for", "the", "REST", "endpoint", "and", "to", "test", "against", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java#L126-L156
28,688
Netflix/spectator
spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java
MetricsController.meterToKind
public static String meterToKind(Registry registry, Meter meter) { String kind; if (meter instanceof Timer) { kind = "Timer"; } else if (meter instanceof Counter) { kind = "Counter"; } else if (meter instanceof Gauge) { kind = "Gauge"; } else if (meter instanceof DistributionSummar...
java
public static String meterToKind(Registry registry, Meter meter) { String kind; if (meter instanceof Timer) { kind = "Timer"; } else if (meter instanceof Counter) { kind = "Counter"; } else if (meter instanceof Gauge) { kind = "Gauge"; } else if (meter instanceof DistributionSummar...
[ "public", "static", "String", "meterToKind", "(", "Registry", "registry", ",", "Meter", "meter", ")", "{", "String", "kind", ";", "if", "(", "meter", "instanceof", "Timer", ")", "{", "kind", "=", "\"Timer\"", ";", "}", "else", "if", "(", "meter", "instan...
Determine the type of a meter for reporting purposes. @param registry Used to provide supplemental information (e.g. to search for the meter). @param meter The meters whose kind we want to know. @return A string such as "Counter". If the type cannot be identified as one of the standard Spectator api interface varian...
[ "Determine", "the", "type", "of", "a", "meter", "for", "reporting", "purposes", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-web-spring/src/main/java/com/netflix/spectator/controllers/MetricsController.java#L172-L186
28,689
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpResponse.java
HttpResponse.header
public String header(String k) { List<String> vs = headers.get(k); return (vs == null || vs.isEmpty()) ? null : vs.get(0); }
java
public String header(String k) { List<String> vs = headers.get(k); return (vs == null || vs.isEmpty()) ? null : vs.get(0); }
[ "public", "String", "header", "(", "String", "k", ")", "{", "List", "<", "String", ">", "vs", "=", "headers", ".", "get", "(", "k", ")", ";", "return", "(", "vs", "==", "null", "||", "vs", ".", "isEmpty", "(", ")", ")", "?", "null", ":", "vs", ...
Return the value for the first occurrence of a given header or null if not found.
[ "Return", "the", "value", "for", "the", "first", "occurrence", "of", "a", "given", "header", "or", "null", "if", "not", "found", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpResponse.java#L66-L69
28,690
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpResponse.java
HttpResponse.dateHeader
public Instant dateHeader(String k) { String d = header(k); return (d == null) ? null : parseDate(d); }
java
public Instant dateHeader(String k) { String d = header(k); return (d == null) ? null : parseDate(d); }
[ "public", "Instant", "dateHeader", "(", "String", "k", ")", "{", "String", "d", "=", "header", "(", "k", ")", ";", "return", "(", "d", "==", "null", ")", "?", "null", ":", "parseDate", "(", "d", ")", ";", "}" ]
Return the value for a date header. The return value will be null if the header does not exist or if it cannot be parsed correctly as a date.
[ "Return", "the", "value", "for", "a", "date", "header", ".", "The", "return", "value", "will", "be", "null", "if", "the", "header", "does", "not", "exist", "or", "if", "it", "cannot", "be", "parsed", "correctly", "as", "a", "date", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpResponse.java#L75-L78
28,691
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpResponse.java
HttpResponse.decompress
public HttpResponse decompress() throws IOException { String enc = header("Content-Encoding"); return (enc != null && enc.contains("gzip")) ? unzip() : this; }
java
public HttpResponse decompress() throws IOException { String enc = header("Content-Encoding"); return (enc != null && enc.contains("gzip")) ? unzip() : this; }
[ "public", "HttpResponse", "decompress", "(", ")", "throws", "IOException", "{", "String", "enc", "=", "header", "(", "\"Content-Encoding\"", ")", ";", "return", "(", "enc", "!=", "null", "&&", "enc", ".", "contains", "(", "\"gzip\"", ")", ")", "?", "unzip"...
Return a copy of the response with the entity decompressed.
[ "Return", "a", "copy", "of", "the", "response", "with", "the", "entity", "decompressed", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpResponse.java#L101-L104
28,692
Netflix/spectator
spectator-agent/src/main/java/com/netflix/spectator/agent/Agent.java
Agent.loadConfig
static Config loadConfig(String userResources) { Config config = ConfigFactory.load("agent"); if (userResources != null && !"".equals(userResources)) { for (String userResource : userResources.split("[,\\s]+")) { if (userResource.startsWith("file:")) { File file = new File(userResource.s...
java
static Config loadConfig(String userResources) { Config config = ConfigFactory.load("agent"); if (userResources != null && !"".equals(userResources)) { for (String userResource : userResources.split("[,\\s]+")) { if (userResource.startsWith("file:")) { File file = new File(userResource.s...
[ "static", "Config", "loadConfig", "(", "String", "userResources", ")", "{", "Config", "config", "=", "ConfigFactory", ".", "load", "(", "\"agent\"", ")", ";", "if", "(", "userResources", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "userResources", ...
Helper to load config files specified by the user.
[ "Helper", "to", "load", "config", "files", "specified", "by", "the", "user", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-agent/src/main/java/com/netflix/spectator/agent/Agent.java#L47-L64
28,693
Netflix/spectator
spectator-agent/src/main/java/com/netflix/spectator/agent/Agent.java
Agent.premain
public static void premain(String arg, Instrumentation instrumentation) throws Exception { // Setup logging Config config = loadConfig(arg); LOGGER.debug("loaded configuration: {}", config.root().render()); createDependencyProperties(config); // Setup Registry AtlasRegistry registry = new Atlas...
java
public static void premain(String arg, Instrumentation instrumentation) throws Exception { // Setup logging Config config = loadConfig(arg); LOGGER.debug("loaded configuration: {}", config.root().render()); createDependencyProperties(config); // Setup Registry AtlasRegistry registry = new Atlas...
[ "public", "static", "void", "premain", "(", "String", "arg", ",", "Instrumentation", "instrumentation", ")", "throws", "Exception", "{", "// Setup logging", "Config", "config", "=", "loadConfig", "(", "arg", ")", ";", "LOGGER", ".", "debug", "(", "\"loaded confi...
Entry point for the agent.
[ "Entry", "point", "for", "the", "agent", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-agent/src/main/java/com/netflix/spectator/agent/Agent.java#L82-L117
28,694
Netflix/spectator
spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/JmxMeasurementConfig.java
JmxMeasurementConfig.from
static JmxMeasurementConfig from(Config config) { String name = config.getString("name"); Map<String, String> tags = config.getConfigList("tags") .stream() .collect(Collectors.toMap(c -> c.getString("key"), c -> c.getString("value"))); String value = config.getString("value"); boolean co...
java
static JmxMeasurementConfig from(Config config) { String name = config.getString("name"); Map<String, String> tags = config.getConfigList("tags") .stream() .collect(Collectors.toMap(c -> c.getString("key"), c -> c.getString("value"))); String value = config.getString("value"); boolean co...
[ "static", "JmxMeasurementConfig", "from", "(", "Config", "config", ")", "{", "String", "name", "=", "config", ".", "getString", "(", "\"name\"", ")", ";", "Map", "<", "String", ",", "String", ">", "tags", "=", "config", ".", "getConfigList", "(", "\"tags\"...
Create from a Typesafe Config object.
[ "Create", "from", "a", "Typesafe", "Config", "object", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-jvm/src/main/java/com/netflix/spectator/jvm/JmxMeasurementConfig.java#L45-L53
28,695
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpUtils.java
HttpUtils.gzip
static byte[] gzip(byte[] data, int level) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(data.length); try (GzipLevelOutputStream out = new GzipLevelOutputStream(baos)) { out.setLevel(level); out.write(data); } return baos.toByteArray(); }
java
static byte[] gzip(byte[] data, int level) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(data.length); try (GzipLevelOutputStream out = new GzipLevelOutputStream(baos)) { out.setLevel(level); out.write(data); } return baos.toByteArray(); }
[ "static", "byte", "[", "]", "gzip", "(", "byte", "[", "]", "data", ",", "int", "level", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", "data", ".", "length", ")", ";", "try", "(", "GzipLevelOut...
Compress a byte array using GZIP with the given compression level.
[ "Compress", "a", "byte", "array", "using", "GZIP", "with", "the", "given", "compression", "level", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpUtils.java#L94-L101
28,696
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpUtils.java
HttpUtils.gunzip
@SuppressWarnings("PMD.AssignmentInOperand") static byte[] gunzip(byte[] data) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(data.length * 10); try (InputStream in = new GZIPInputStream(new ByteArrayInputStream(data))) { byte[] buffer = new byte[4096]; int length; ...
java
@SuppressWarnings("PMD.AssignmentInOperand") static byte[] gunzip(byte[] data) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(data.length * 10); try (InputStream in = new GZIPInputStream(new ByteArrayInputStream(data))) { byte[] buffer = new byte[4096]; int length; ...
[ "@", "SuppressWarnings", "(", "\"PMD.AssignmentInOperand\"", ")", "static", "byte", "[", "]", "gunzip", "(", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", "data", ".", "len...
Decompress a GZIP compressed byte array.
[ "Decompress", "a", "GZIP", "compressed", "byte", "array", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpUtils.java#L104-L115
28,697
Netflix/spectator
spectator-nflx-plugin/src/main/java/com/netflix/spectator/nflx/NetflixConfig.java
NetflixConfig.createConfig
public static Config createConfig(Config config) { try { // We cannot use the libraries layer as the nf-archaius2-platform-bridge // will delegate the Config binding to archaius1 and the libraries layer // then wraps that. So anything added to the libraries layer will not get // picked up by...
java
public static Config createConfig(Config config) { try { // We cannot use the libraries layer as the nf-archaius2-platform-bridge // will delegate the Config binding to archaius1 and the libraries layer // then wraps that. So anything added to the libraries layer will not get // picked up by...
[ "public", "static", "Config", "createConfig", "(", "Config", "config", ")", "{", "try", "{", "// We cannot use the libraries layer as the nf-archaius2-platform-bridge", "// will delegate the Config binding to archaius1 and the libraries layer", "// then wraps that. So anything added to the...
Create a config to be used in the Netflix Cloud.
[ "Create", "a", "config", "to", "be", "used", "in", "the", "Netflix", "Cloud", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-nflx-plugin/src/main/java/com/netflix/spectator/nflx/NetflixConfig.java#L51-L77
28,698
Netflix/spectator
spectator-nflx-plugin/src/main/java/com/netflix/spectator/nflx/NetflixConfig.java
NetflixConfig.commonTags
public static Map<String, String> commonTags() { final Map<String, String> commonTags = new HashMap<>(); put(commonTags, "nf.app", Env.app()); put(commonTags, "nf.cluster", Env.cluster()); put(commonTags, "nf.asg", Env.asg()); put(commonTags, "nf.stack", Env.stack()); put(commonTags, "nf.zone", ...
java
public static Map<String, String> commonTags() { final Map<String, String> commonTags = new HashMap<>(); put(commonTags, "nf.app", Env.app()); put(commonTags, "nf.cluster", Env.cluster()); put(commonTags, "nf.asg", Env.asg()); put(commonTags, "nf.stack", Env.stack()); put(commonTags, "nf.zone", ...
[ "public", "static", "Map", "<", "String", ",", "String", ">", "commonTags", "(", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "commonTags", "=", "new", "HashMap", "<>", "(", ")", ";", "put", "(", "commonTags", ",", "\"nf.app\"", ",", ...
Infrastructure tags that are common across all metrics. Used for deduplication and for providing a scope for the metrics produced.
[ "Infrastructure", "tags", "that", "are", "common", "across", "all", "metrics", ".", "Used", "for", "deduplication", "and", "for", "providing", "a", "scope", "for", "the", "metrics", "produced", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-nflx-plugin/src/main/java/com/netflix/spectator/nflx/NetflixConfig.java#L115-L129
28,699
Netflix/spectator
spectator-ext-spark/src/main/java/com/netflix/spectator/spark/SparkNameFunction.java
SparkNameFunction.fromConfig
public static SparkNameFunction fromConfig(Config config, String key, Registry registry) { return fromPatternList(config.getConfigList(key), registry); }
java
public static SparkNameFunction fromConfig(Config config, String key, Registry registry) { return fromPatternList(config.getConfigList(key), registry); }
[ "public", "static", "SparkNameFunction", "fromConfig", "(", "Config", "config", ",", "String", "key", ",", "Registry", "registry", ")", "{", "return", "fromPatternList", "(", "config", ".", "getConfigList", "(", "key", ")", ",", "registry", ")", ";", "}" ]
Create a name function based on a config.
[ "Create", "a", "name", "function", "based", "on", "a", "config", "." ]
259318252770de3bad581b85adff187d8f2c6537
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-spark/src/main/java/com/netflix/spectator/spark/SparkNameFunction.java#L50-L52