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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
49,500 | BoltsFramework/Bolts-Android | bolts-applinks/src/main/java/bolts/AppLinks.java | AppLinks.getTargetUrl | public static Uri getTargetUrl(Intent intent) {
Bundle appLinkData = getAppLinkData(intent);
if (appLinkData != null) {
String targetString = appLinkData.getString(KEY_NAME_TARGET);
if (targetString != null) {
return Uri.parse(targetString);
}
}
return intent.getData();
} | java | public static Uri getTargetUrl(Intent intent) {
Bundle appLinkData = getAppLinkData(intent);
if (appLinkData != null) {
String targetString = appLinkData.getString(KEY_NAME_TARGET);
if (targetString != null) {
return Uri.parse(targetString);
}
}
return intent.getData();
} | [
"public",
"static",
"Uri",
"getTargetUrl",
"(",
"Intent",
"intent",
")",
"{",
"Bundle",
"appLinkData",
"=",
"getAppLinkData",
"(",
"intent",
")",
";",
"if",
"(",
"appLinkData",
"!=",
"null",
")",
"{",
"String",
"targetString",
"=",
"appLinkData",
".",
"getSt... | Gets the target URL for an intent, regardless of whether the intent is from an App Link. If the
intent is from an App Link, this will be the App Link target. Otherwise, it will be the data
Uri from the intent itself.
@param intent the incoming intent.
@return the target URL for the intent. | [
"Gets",
"the",
"target",
"URL",
"for",
"an",
"intent",
"regardless",
"of",
"whether",
"the",
"intent",
"is",
"from",
"an",
"App",
"Link",
".",
"If",
"the",
"intent",
"is",
"from",
"an",
"App",
"Link",
"this",
"will",
"be",
"the",
"App",
"Link",
"target... | 54e9cb8bdd4950aa4d418dcbc0ea65414762aef5 | https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-applinks/src/main/java/bolts/AppLinks.java#L59-L68 |
49,501 | BoltsFramework/Bolts-Android | bolts-applinks/src/main/java/bolts/AppLinks.java | AppLinks.getTargetUrlFromInboundIntent | public static Uri getTargetUrlFromInboundIntent(Context context, Intent intent) {
Bundle appLinkData = getAppLinkData(intent);
if (appLinkData != null) {
String targetString = appLinkData.getString(KEY_NAME_TARGET);
if (targetString != null) {
MeasurementEvent.sendBroadcastEvent(context, Mea... | java | public static Uri getTargetUrlFromInboundIntent(Context context, Intent intent) {
Bundle appLinkData = getAppLinkData(intent);
if (appLinkData != null) {
String targetString = appLinkData.getString(KEY_NAME_TARGET);
if (targetString != null) {
MeasurementEvent.sendBroadcastEvent(context, Mea... | [
"public",
"static",
"Uri",
"getTargetUrlFromInboundIntent",
"(",
"Context",
"context",
",",
"Intent",
"intent",
")",
"{",
"Bundle",
"appLinkData",
"=",
"getAppLinkData",
"(",
"intent",
")",
";",
"if",
"(",
"appLinkData",
"!=",
"null",
")",
"{",
"String",
"targ... | Gets the target URL for an intent. If the intent is from an App Link, this will be the App Link target.
Otherwise, it return null; For app link intent, this function will broadcast APP_LINK_NAVIGATE_IN_EVENT_NAME event.
@param context the context this function is called within.
@param intent the incoming intent.
@retu... | [
"Gets",
"the",
"target",
"URL",
"for",
"an",
"intent",
".",
"If",
"the",
"intent",
"is",
"from",
"an",
"App",
"Link",
"this",
"will",
"be",
"the",
"App",
"Link",
"target",
".",
"Otherwise",
"it",
"return",
"null",
";",
"For",
"app",
"link",
"intent",
... | 54e9cb8bdd4950aa4d418dcbc0ea65414762aef5 | https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-applinks/src/main/java/bolts/AppLinks.java#L78-L88 |
49,502 | BoltsFramework/Bolts-Android | bolts-applinks/src/main/java/bolts/AppLinkNavigation.java | AppLinkNavigation.buildAppLinkDataForNavigation | private Bundle buildAppLinkDataForNavigation(Context context) {
Bundle data = new Bundle();
Bundle refererAppLinkData = new Bundle();
if (context != null) {
String refererAppPackage = context.getPackageName();
if (refererAppPackage != null) {
refererAppLinkData.putString(KEY_NAME_REFERER... | java | private Bundle buildAppLinkDataForNavigation(Context context) {
Bundle data = new Bundle();
Bundle refererAppLinkData = new Bundle();
if (context != null) {
String refererAppPackage = context.getPackageName();
if (refererAppPackage != null) {
refererAppLinkData.putString(KEY_NAME_REFERER... | [
"private",
"Bundle",
"buildAppLinkDataForNavigation",
"(",
"Context",
"context",
")",
"{",
"Bundle",
"data",
"=",
"new",
"Bundle",
"(",
")",
";",
"Bundle",
"refererAppLinkData",
"=",
"new",
"Bundle",
"(",
")",
";",
"if",
"(",
"context",
"!=",
"null",
")",
... | Creates a bundle containing the final, constructed App Link data to be used in navigation. | [
"Creates",
"a",
"bundle",
"containing",
"the",
"final",
"constructed",
"App",
"Link",
"data",
"to",
"be",
"used",
"in",
"navigation",
"."
] | 54e9cb8bdd4950aa4d418dcbc0ea65414762aef5 | https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-applinks/src/main/java/bolts/AppLinkNavigation.java#L134-L157 |
49,503 | BoltsFramework/Bolts-Android | bolts-applinks/src/main/java/bolts/AppLinkNavigation.java | AppLinkNavigation.getJSONForBundle | private JSONObject getJSONForBundle(Bundle bundle) throws JSONException {
JSONObject root = new JSONObject();
for (String key : bundle.keySet()) {
root.put(key, getJSONValue(bundle.get(key)));
}
return root;
} | java | private JSONObject getJSONForBundle(Bundle bundle) throws JSONException {
JSONObject root = new JSONObject();
for (String key : bundle.keySet()) {
root.put(key, getJSONValue(bundle.get(key)));
}
return root;
} | [
"private",
"JSONObject",
"getJSONForBundle",
"(",
"Bundle",
"bundle",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"root",
"=",
"new",
"JSONObject",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"bundle",
".",
"keySet",
"(",
")",
")",
"{",
"root",... | Gets a JSONObject equivalent to the input bundle for use when falling back to a web navigation. | [
"Gets",
"a",
"JSONObject",
"equivalent",
"to",
"the",
"input",
"bundle",
"for",
"use",
"when",
"falling",
"back",
"to",
"a",
"web",
"navigation",
"."
] | 54e9cb8bdd4950aa4d418dcbc0ea65414762aef5 | https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-applinks/src/main/java/bolts/AppLinkNavigation.java#L251-L257 |
49,504 | BoltsFramework/Bolts-Android | bolts-applinks/src/main/java/bolts/AppLinkNavigation.java | AppLinkNavigation.navigate | public NavigationResult navigate(Context context) {
PackageManager pm = context.getPackageManager();
Bundle finalAppLinkData = buildAppLinkDataForNavigation(context);
Intent eligibleTargetIntent = null;
for (AppLink.Target target : getAppLink().getTargets()) {
Intent targetIntent = new Intent(Int... | java | public NavigationResult navigate(Context context) {
PackageManager pm = context.getPackageManager();
Bundle finalAppLinkData = buildAppLinkDataForNavigation(context);
Intent eligibleTargetIntent = null;
for (AppLink.Target target : getAppLink().getTargets()) {
Intent targetIntent = new Intent(Int... | [
"public",
"NavigationResult",
"navigate",
"(",
"Context",
"context",
")",
"{",
"PackageManager",
"pm",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"Bundle",
"finalAppLinkData",
"=",
"buildAppLinkDataForNavigation",
"(",
"context",
")",
";",
"Intent",
... | Performs the navigation.
@param context the Context from which the navigation should be performed.
@return the {@link NavigationResult} performed by navigating. | [
"Performs",
"the",
"navigation",
"."
] | 54e9cb8bdd4950aa4d418dcbc0ea65414762aef5 | https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-applinks/src/main/java/bolts/AppLinkNavigation.java#L265-L319 |
49,505 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/SpectatorContext.java | SpectatorContext.setRegistry | public static void setRegistry(Registry registry) {
SpectatorContext.registry = registry;
if (registry instanceof NoopRegistry) {
initStacktrace = null;
} else {
Exception cause = initStacktrace;
Exception e = new IllegalStateException(
"called SpectatorContext.setRegistry(" + re... | java | public static void setRegistry(Registry registry) {
SpectatorContext.registry = registry;
if (registry instanceof NoopRegistry) {
initStacktrace = null;
} else {
Exception cause = initStacktrace;
Exception e = new IllegalStateException(
"called SpectatorContext.setRegistry(" + re... | [
"public",
"static",
"void",
"setRegistry",
"(",
"Registry",
"registry",
")",
"{",
"SpectatorContext",
".",
"registry",
"=",
"registry",
";",
"if",
"(",
"registry",
"instanceof",
"NoopRegistry",
")",
"{",
"initStacktrace",
"=",
"null",
";",
"}",
"else",
"{",
... | Set the registry to use. By default it will use the NoopRegistry. | [
"Set",
"the",
"registry",
"to",
"use",
".",
"By",
"default",
"it",
"will",
"use",
"the",
"NoopRegistry",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/SpectatorContext.java#L79-L95 |
49,506 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/SpectatorContext.java | SpectatorContext.gauge | public static LazyGauge gauge(MonitorConfig config) {
return new LazyGauge(Registry::gauge, registry, createId(config));
} | java | public static LazyGauge gauge(MonitorConfig config) {
return new LazyGauge(Registry::gauge, registry, createId(config));
} | [
"public",
"static",
"LazyGauge",
"gauge",
"(",
"MonitorConfig",
"config",
")",
"{",
"return",
"new",
"LazyGauge",
"(",
"Registry",
"::",
"gauge",
",",
"registry",
",",
"createId",
"(",
"config",
")",
")",
";",
"}"
] | Create a gauge based on the config. | [
"Create",
"a",
"gauge",
"based",
"on",
"the",
"config",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/SpectatorContext.java#L105-L107 |
49,507 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/SpectatorContext.java | SpectatorContext.maxGauge | public static LazyGauge maxGauge(MonitorConfig config) {
return new LazyGauge(Registry::maxGauge, registry, createId(config));
} | java | public static LazyGauge maxGauge(MonitorConfig config) {
return new LazyGauge(Registry::maxGauge, registry, createId(config));
} | [
"public",
"static",
"LazyGauge",
"maxGauge",
"(",
"MonitorConfig",
"config",
")",
"{",
"return",
"new",
"LazyGauge",
"(",
"Registry",
"::",
"maxGauge",
",",
"registry",
",",
"createId",
"(",
"config",
")",
")",
";",
"}"
] | Create a max gauge based on the config. | [
"Create",
"a",
"max",
"gauge",
"based",
"on",
"the",
"config",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/SpectatorContext.java#L110-L112 |
49,508 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/SpectatorContext.java | SpectatorContext.createId | public static Id createId(MonitorConfig config) {
// Need to ensure that Servo type tag is removed to avoid incorrectly reprocessing the
// data in later transforms
Map<String, String> tags = new HashMap<>(config.getTags().asMap());
tags.remove("type");
return registry
.createId(config.getNa... | java | public static Id createId(MonitorConfig config) {
// Need to ensure that Servo type tag is removed to avoid incorrectly reprocessing the
// data in later transforms
Map<String, String> tags = new HashMap<>(config.getTags().asMap());
tags.remove("type");
return registry
.createId(config.getNa... | [
"public",
"static",
"Id",
"createId",
"(",
"MonitorConfig",
"config",
")",
"{",
"// Need to ensure that Servo type tag is removed to avoid incorrectly reprocessing the",
"// data in later transforms",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
"=",
"new",
"HashMap",
... | Convert servo config to spectator id. | [
"Convert",
"servo",
"config",
"to",
"spectator",
"id",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/SpectatorContext.java#L130-L138 |
49,509 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/SpectatorContext.java | SpectatorContext.polledGauge | public static PolledMeter.Builder polledGauge(MonitorConfig config) {
long delayMillis = Math.max(Pollers.getPollingIntervals().get(0) - 1000, 5000);
Id id = createId(config);
PolledMeter.remove(registry, id);
return PolledMeter.using(registry)
.withId(id)
.withDelay(Duration.ofMillis(de... | java | public static PolledMeter.Builder polledGauge(MonitorConfig config) {
long delayMillis = Math.max(Pollers.getPollingIntervals().get(0) - 1000, 5000);
Id id = createId(config);
PolledMeter.remove(registry, id);
return PolledMeter.using(registry)
.withId(id)
.withDelay(Duration.ofMillis(de... | [
"public",
"static",
"PolledMeter",
".",
"Builder",
"polledGauge",
"(",
"MonitorConfig",
"config",
")",
"{",
"long",
"delayMillis",
"=",
"Math",
".",
"max",
"(",
"Pollers",
".",
"getPollingIntervals",
"(",
")",
".",
"get",
"(",
"0",
")",
"-",
"1000",
",",
... | Create builder for a polled gauge based on the config. | [
"Create",
"builder",
"for",
"a",
"polled",
"gauge",
"based",
"on",
"the",
"config",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/SpectatorContext.java#L146-L154 |
49,510 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/SpectatorContext.java | SpectatorContext.register | public static void register(Monitor<?> monitor) {
if (monitor instanceof SpectatorMonitor) {
((SpectatorMonitor) monitor).initializeSpectator(BasicTagList.EMPTY);
} else if (!isEmptyComposite(monitor)) {
ServoMeter m = new ServoMeter(monitor);
PolledMeter.remove(registry, m.id());
Polled... | java | public static void register(Monitor<?> monitor) {
if (monitor instanceof SpectatorMonitor) {
((SpectatorMonitor) monitor).initializeSpectator(BasicTagList.EMPTY);
} else if (!isEmptyComposite(monitor)) {
ServoMeter m = new ServoMeter(monitor);
PolledMeter.remove(registry, m.id());
Polled... | [
"public",
"static",
"void",
"register",
"(",
"Monitor",
"<",
"?",
">",
"monitor",
")",
"{",
"if",
"(",
"monitor",
"instanceof",
"SpectatorMonitor",
")",
"{",
"(",
"(",
"SpectatorMonitor",
")",
"monitor",
")",
".",
"initializeSpectator",
"(",
"BasicTagList",
... | Register a custom monitor. | [
"Register",
"a",
"custom",
"monitor",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/SpectatorContext.java#L157-L166 |
49,511 | Netflix/servo | servo-aws/src/main/java/com/netflix/servo/aws/AwsServiceClients.java | AwsServiceClients.cloudWatch | public static AmazonCloudWatch cloudWatch(AWSCredentialsProvider credentials) {
AmazonCloudWatch client = new AmazonCloudWatchClient(credentials);
client.setEndpoint(System.getProperty(AwsPropertyKeys.AWS_CLOUD_WATCH_END_POINT.getBundle(),
"monitoring.amazonaws.com"));
return client;
} | java | public static AmazonCloudWatch cloudWatch(AWSCredentialsProvider credentials) {
AmazonCloudWatch client = new AmazonCloudWatchClient(credentials);
client.setEndpoint(System.getProperty(AwsPropertyKeys.AWS_CLOUD_WATCH_END_POINT.getBundle(),
"monitoring.amazonaws.com"));
return client;
} | [
"public",
"static",
"AmazonCloudWatch",
"cloudWatch",
"(",
"AWSCredentialsProvider",
"credentials",
")",
"{",
"AmazonCloudWatch",
"client",
"=",
"new",
"AmazonCloudWatchClient",
"(",
"credentials",
")",
";",
"client",
".",
"setEndpoint",
"(",
"System",
".",
"getProper... | Get a CloudWatch client whose endpoint is configured based on properties. | [
"Get",
"a",
"CloudWatch",
"client",
"whose",
"endpoint",
"is",
"configured",
"based",
"on",
"properties",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-aws/src/main/java/com/netflix/servo/aws/AwsServiceClients.java#L36-L41 |
49,512 | Netflix/servo | servo-aws/src/main/java/com/netflix/servo/aws/AwsServiceClients.java | AwsServiceClients.autoScaling | public static AmazonAutoScaling autoScaling(AWSCredentials credentials) {
AmazonAutoScaling client = new AmazonAutoScalingClient(credentials);
client.setEndpoint(System.getProperty(
AwsPropertyKeys.AWS_AUTO_SCALING_END_POINT.getBundle(),
"autoscaling.amazonaws.com"));
return client;
} | java | public static AmazonAutoScaling autoScaling(AWSCredentials credentials) {
AmazonAutoScaling client = new AmazonAutoScalingClient(credentials);
client.setEndpoint(System.getProperty(
AwsPropertyKeys.AWS_AUTO_SCALING_END_POINT.getBundle(),
"autoscaling.amazonaws.com"));
return client;
} | [
"public",
"static",
"AmazonAutoScaling",
"autoScaling",
"(",
"AWSCredentials",
"credentials",
")",
"{",
"AmazonAutoScaling",
"client",
"=",
"new",
"AmazonAutoScalingClient",
"(",
"credentials",
")",
";",
"client",
".",
"setEndpoint",
"(",
"System",
".",
"getProperty",... | Get an AutoScaling client whose endpoint is configured based on properties. | [
"Get",
"an",
"AutoScaling",
"client",
"whose",
"endpoint",
"is",
"configured",
"based",
"on",
"properties",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-aws/src/main/java/com/netflix/servo/aws/AwsServiceClients.java#L46-L52 |
49,513 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/DynamicTimer.java | DynamicTimer.start | public static Stopwatch start(MonitorConfig config, TimeUnit unit) {
return INSTANCE.get(config, unit).start();
} | java | public static Stopwatch start(MonitorConfig config, TimeUnit unit) {
return INSTANCE.get(config, unit).start();
} | [
"public",
"static",
"Stopwatch",
"start",
"(",
"MonitorConfig",
"config",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"INSTANCE",
".",
"get",
"(",
"config",
",",
"unit",
")",
".",
"start",
"(",
")",
";",
"}"
] | Returns a stopwatch that has been started and will automatically
record its result to the dynamic timer specified by the given config.
@param config Config to identify a particular timer instance to update.
@param unit The unit to use when reporting values to observers. For example if sent to
a typical time series g... | [
"Returns",
"a",
"stopwatch",
"that",
"has",
"been",
"started",
"and",
"will",
"automatically",
"record",
"its",
"result",
"to",
"the",
"dynamic",
"timer",
"specified",
"by",
"the",
"given",
"config",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/DynamicTimer.java#L120-L122 |
49,514 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/DynamicTimer.java | DynamicTimer.start | public static Stopwatch start(MonitorConfig config) {
return INSTANCE.get(config, TimeUnit.MILLISECONDS).start();
} | java | public static Stopwatch start(MonitorConfig config) {
return INSTANCE.get(config, TimeUnit.MILLISECONDS).start();
} | [
"public",
"static",
"Stopwatch",
"start",
"(",
"MonitorConfig",
"config",
")",
"{",
"return",
"INSTANCE",
".",
"get",
"(",
"config",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
".",
"start",
"(",
")",
";",
"}"
] | Returns a stopwatch that has been started and will automatically
record its result to the dynamic timer specified by the given config. The timer
will report the times in milliseconds to observers.
@see #start(MonitorConfig, TimeUnit) | [
"Returns",
"a",
"stopwatch",
"that",
"has",
"been",
"started",
"and",
"will",
"automatically",
"record",
"its",
"result",
"to",
"the",
"dynamic",
"timer",
"specified",
"by",
"the",
"given",
"config",
".",
"The",
"timer",
"will",
"report",
"the",
"times",
"in... | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/DynamicTimer.java#L131-L133 |
49,515 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/DynamicTimer.java | DynamicTimer.record | public static void record(MonitorConfig config, long duration) {
INSTANCE.get(config, TimeUnit.MILLISECONDS).record(duration, TimeUnit.MILLISECONDS);
} | java | public static void record(MonitorConfig config, long duration) {
INSTANCE.get(config, TimeUnit.MILLISECONDS).record(duration, TimeUnit.MILLISECONDS);
} | [
"public",
"static",
"void",
"record",
"(",
"MonitorConfig",
"config",
",",
"long",
"duration",
")",
"{",
"INSTANCE",
".",
"get",
"(",
"config",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
".",
"record",
"(",
"duration",
",",
"TimeUnit",
".",
"MILLISECONDS",
... | Record result to the dynamic timer indicated by the provided config
with a TimeUnit of milliseconds. | [
"Record",
"result",
"to",
"the",
"dynamic",
"timer",
"indicated",
"by",
"the",
"provided",
"config",
"with",
"a",
"TimeUnit",
"of",
"milliseconds",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/DynamicTimer.java#L139-L141 |
49,516 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/DynamicTimer.java | DynamicTimer.record | public static void record(MonitorConfig config, long duration, TimeUnit unit) {
INSTANCE.get(config, unit).record(duration, unit);
} | java | public static void record(MonitorConfig config, long duration, TimeUnit unit) {
INSTANCE.get(config, unit).record(duration, unit);
} | [
"public",
"static",
"void",
"record",
"(",
"MonitorConfig",
"config",
",",
"long",
"duration",
",",
"TimeUnit",
"unit",
")",
"{",
"INSTANCE",
".",
"get",
"(",
"config",
",",
"unit",
")",
".",
"record",
"(",
"duration",
",",
"unit",
")",
";",
"}"
] | Record a duration to the dynamic timer indicated by the provided config.
The units in which the timer is reported and the duration unit are the same.
@deprecated Use {@link DynamicTimer#record(MonitorConfig, java.util.concurrent.TimeUnit,
long, java.util.concurrent.TimeUnit)} instead.
The new method allows you to be ... | [
"Record",
"a",
"duration",
"to",
"the",
"dynamic",
"timer",
"indicated",
"by",
"the",
"provided",
"config",
".",
"The",
"units",
"in",
"which",
"the",
"timer",
"is",
"reported",
"and",
"the",
"duration",
"unit",
"are",
"the",
"same",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/DynamicTimer.java#L152-L154 |
49,517 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/DynamicTimer.java | DynamicTimer.start | public static Stopwatch start(String name, TagList list, TimeUnit unit) {
final MonitorConfig config = new MonitorConfig.Builder(name).withTags(list).build();
return INSTANCE.get(config, unit).start();
} | java | public static Stopwatch start(String name, TagList list, TimeUnit unit) {
final MonitorConfig config = new MonitorConfig.Builder(name).withTags(list).build();
return INSTANCE.get(config, unit).start();
} | [
"public",
"static",
"Stopwatch",
"start",
"(",
"String",
"name",
",",
"TagList",
"list",
",",
"TimeUnit",
"unit",
")",
"{",
"final",
"MonitorConfig",
"config",
"=",
"new",
"MonitorConfig",
".",
"Builder",
"(",
"name",
")",
".",
"withTags",
"(",
"list",
")"... | Returns a stopwatch that has been started and will automatically
record its result to the dynamic timer specified by the given config. The timer
uses a TimeUnit of milliseconds. | [
"Returns",
"a",
"stopwatch",
"that",
"has",
"been",
"started",
"and",
"will",
"automatically",
"record",
"its",
"result",
"to",
"the",
"dynamic",
"timer",
"specified",
"by",
"the",
"given",
"config",
".",
"The",
"timer",
"uses",
"a",
"TimeUnit",
"of",
"milli... | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/DynamicTimer.java#L206-L209 |
49,518 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/BasicStopwatch.java | BasicStopwatch.getDuration | @Override
public long getDuration() {
final long end = running.get() ? System.nanoTime() : endTime.get();
return end - startTime.get();
} | java | @Override
public long getDuration() {
final long end = running.get() ? System.nanoTime() : endTime.get();
return end - startTime.get();
} | [
"@",
"Override",
"public",
"long",
"getDuration",
"(",
")",
"{",
"final",
"long",
"end",
"=",
"running",
".",
"get",
"(",
")",
"?",
"System",
".",
"nanoTime",
"(",
")",
":",
"endTime",
".",
"get",
"(",
")",
";",
"return",
"end",
"-",
"startTime",
"... | Returns the duration in nanoseconds. No checks are performed to ensure that the stopwatch
has been properly started and stopped before executing this method. If called before stop
it will return the current duration. | [
"Returns",
"the",
"duration",
"in",
"nanoseconds",
".",
"No",
"checks",
"are",
"performed",
"to",
"ensure",
"that",
"the",
"stopwatch",
"has",
"been",
"properly",
"started",
"and",
"stopped",
"before",
"executing",
"this",
"method",
".",
"If",
"called",
"befor... | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/BasicStopwatch.java#L71-L75 |
49,519 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/Memoizer.java | Memoizer.create | public static <T> Memoizer<T> create(Callable<T> getter, long duration, TimeUnit unit) {
return new Memoizer<>(getter, duration, unit);
} | java | public static <T> Memoizer<T> create(Callable<T> getter, long duration, TimeUnit unit) {
return new Memoizer<>(getter, duration, unit);
} | [
"public",
"static",
"<",
"T",
">",
"Memoizer",
"<",
"T",
">",
"create",
"(",
"Callable",
"<",
"T",
">",
"getter",
",",
"long",
"duration",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"new",
"Memoizer",
"<>",
"(",
"getter",
",",
"duration",
",",
"uni... | Create a memoizer that caches the value produced by getter for a given duration.
@param getter A {@link Callable} that returns a new value. This should not throw.
@param duration how long we should keep the cached value before refreshing it.
@param unit unit of time for {@code duration}
@param <T> type of t... | [
"Create",
"a",
"memoizer",
"that",
"caches",
"the",
"value",
"produced",
"by",
"getter",
"for",
"a",
"given",
"duration",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/Memoizer.java#L37-L39 |
49,520 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/Memoizer.java | Memoizer.get | public T get() {
long expiration = whenItExpires;
long now = System.nanoTime();
// if uninitialized or expired update value
if (expiration == 0 || now >= expiration) {
synchronized (this) {
// ensure a different thread didn't update it
if (whenItExpires == expiration) {
... | java | public T get() {
long expiration = whenItExpires;
long now = System.nanoTime();
// if uninitialized or expired update value
if (expiration == 0 || now >= expiration) {
synchronized (this) {
// ensure a different thread didn't update it
if (whenItExpires == expiration) {
... | [
"public",
"T",
"get",
"(",
")",
"{",
"long",
"expiration",
"=",
"whenItExpires",
";",
"long",
"now",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"// if uninitialized or expired update value",
"if",
"(",
"expiration",
"==",
"0",
"||",
"now",
">=",
"expirat... | Get or refresh and return the latest value. | [
"Get",
"or",
"refresh",
"and",
"return",
"the",
"latest",
"value",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/Memoizer.java#L54-L74 |
49,521 | Netflix/servo | servo-atlas/src/main/java/com/netflix/servo/publish/atlas/AtlasMetricObserver.java | AtlasMetricObserver.push | public void push(List<Metric> rawMetrics) {
List<Metric> validMetrics = ValidCharacters.toValidValues(filter(rawMetrics));
List<Metric> metrics = transformMetrics(validMetrics);
LOGGER.debug("Scheduling push of {} metrics", metrics.size());
final UpdateTasks tasks = getUpdateTasks(BasicTagList.EMPTY,
... | java | public void push(List<Metric> rawMetrics) {
List<Metric> validMetrics = ValidCharacters.toValidValues(filter(rawMetrics));
List<Metric> metrics = transformMetrics(validMetrics);
LOGGER.debug("Scheduling push of {} metrics", metrics.size());
final UpdateTasks tasks = getUpdateTasks(BasicTagList.EMPTY,
... | [
"public",
"void",
"push",
"(",
"List",
"<",
"Metric",
">",
"rawMetrics",
")",
"{",
"List",
"<",
"Metric",
">",
"validMetrics",
"=",
"ValidCharacters",
".",
"toValidValues",
"(",
"filter",
"(",
"rawMetrics",
")",
")",
";",
"List",
"<",
"Metric",
">",
"met... | Immediately send metrics to the backend.
@param rawMetrics Metrics to be sent. Names and tags will be sanitized. | [
"Immediately",
"send",
"metrics",
"to",
"the",
"backend",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-atlas/src/main/java/com/netflix/servo/publish/atlas/AtlasMetricObserver.java#L219-L241 |
49,522 | Netflix/servo | servo-atlas/src/main/java/com/netflix/servo/publish/atlas/AtlasMetricObserver.java | AtlasMetricObserver.withBookkeeping | protected Func1<HttpClientResponse<ByteBuf>, Integer> withBookkeeping(final int batchSize) {
return response -> {
boolean ok = response.getStatus().code() == 200;
if (ok) {
numMetricsSent.increment(batchSize);
} else {
LOGGER.info("Status code: {} - Lost {} metrics",
re... | java | protected Func1<HttpClientResponse<ByteBuf>, Integer> withBookkeeping(final int batchSize) {
return response -> {
boolean ok = response.getStatus().code() == 200;
if (ok) {
numMetricsSent.increment(batchSize);
} else {
LOGGER.info("Status code: {} - Lost {} metrics",
re... | [
"protected",
"Func1",
"<",
"HttpClientResponse",
"<",
"ByteBuf",
">",
",",
"Integer",
">",
"withBookkeeping",
"(",
"final",
"int",
"batchSize",
")",
"{",
"return",
"response",
"->",
"{",
"boolean",
"ok",
"=",
"response",
".",
"getStatus",
"(",
")",
".",
"c... | Utility function to map an Observable<ByteBuf> to an Observable<Integer> while also
updating our counters for metrics sent and errors. | [
"Utility",
"function",
"to",
"map",
"an",
"Observable<",
";",
"ByteBuf",
">",
"to",
"an",
"Observable<",
";",
"Integer",
">",
"while",
"also",
"updating",
"our",
"counters",
"for",
"metrics",
"sent",
"and",
"errors",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-atlas/src/main/java/com/netflix/servo/publish/atlas/AtlasMetricObserver.java#L372-L385 |
49,523 | Netflix/servo | servo-example/src/main/java/com/netflix/servo/example/Config.java | Config.getAtlasConfig | public static ServoAtlasConfig getAtlasConfig() {
return new ServoAtlasConfig() {
@Override
public String getAtlasUri() {
return getAtlasObserverUri();
}
@Override
public int getPushQueueSize() {
return 1000;
}
@Override
public boolean shouldSendMetr... | java | public static ServoAtlasConfig getAtlasConfig() {
return new ServoAtlasConfig() {
@Override
public String getAtlasUri() {
return getAtlasObserverUri();
}
@Override
public int getPushQueueSize() {
return 1000;
}
@Override
public boolean shouldSendMetr... | [
"public",
"static",
"ServoAtlasConfig",
"getAtlasConfig",
"(",
")",
"{",
"return",
"new",
"ServoAtlasConfig",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"getAtlasUri",
"(",
")",
"{",
"return",
"getAtlasObserverUri",
"(",
")",
";",
"}",
"@",
"Override"... | Get config for the atlas observer. | [
"Get",
"config",
"for",
"the",
"atlas",
"observer",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-example/src/main/java/com/netflix/servo/example/Config.java#L105-L127 |
49,524 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/Reflection.java | Reflection.getAllFields | public static Set<Field> getAllFields(Class<?> classs) {
Set<Field> set = new HashSet<>();
Class<?> c = classs;
while (c != null) {
set.addAll(Arrays.asList(c.getDeclaredFields()));
c = c.getSuperclass();
}
return set;
} | java | public static Set<Field> getAllFields(Class<?> classs) {
Set<Field> set = new HashSet<>();
Class<?> c = classs;
while (c != null) {
set.addAll(Arrays.asList(c.getDeclaredFields()));
c = c.getSuperclass();
}
return set;
} | [
"public",
"static",
"Set",
"<",
"Field",
">",
"getAllFields",
"(",
"Class",
"<",
"?",
">",
"classs",
")",
"{",
"Set",
"<",
"Field",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"Class",
"<",
"?",
">",
"c",
"=",
"classs",
";",
"while",
... | Gets all fields from class and its super classes.
@param classs class to get fields from
@return set of fields | [
"Gets",
"all",
"fields",
"from",
"class",
"and",
"its",
"super",
"classes",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/Reflection.java#L39-L47 |
49,525 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/Reflection.java | Reflection.getAllMethods | public static Set<Method> getAllMethods(Class<?> classs) {
Set<Method> set = new HashSet<>();
Class<?> c = classs;
while (c != null) {
set.addAll(Arrays.asList(c.getDeclaredMethods()));
c = c.getSuperclass();
}
return set;
} | java | public static Set<Method> getAllMethods(Class<?> classs) {
Set<Method> set = new HashSet<>();
Class<?> c = classs;
while (c != null) {
set.addAll(Arrays.asList(c.getDeclaredMethods()));
c = c.getSuperclass();
}
return set;
} | [
"public",
"static",
"Set",
"<",
"Method",
">",
"getAllMethods",
"(",
"Class",
"<",
"?",
">",
"classs",
")",
"{",
"Set",
"<",
"Method",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"Class",
"<",
"?",
">",
"c",
"=",
"classs",
";",
"while... | Gets all methods from class and its super classes.
@param classs class to get methods from
@return set of methods | [
"Gets",
"all",
"methods",
"from",
"class",
"and",
"its",
"super",
"classes",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/Reflection.java#L55-L63 |
49,526 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/Reflection.java | Reflection.getFieldsAnnotatedBy | public static Set<Field> getFieldsAnnotatedBy(Class<?> classs, Class<? extends Annotation> ann) {
Set<Field> set = new HashSet<>();
for (Field field : getAllFields(classs)) {
if (field.isAnnotationPresent(ann)) {
set.add(field);
}
}
return set;
} | java | public static Set<Field> getFieldsAnnotatedBy(Class<?> classs, Class<? extends Annotation> ann) {
Set<Field> set = new HashSet<>();
for (Field field : getAllFields(classs)) {
if (field.isAnnotationPresent(ann)) {
set.add(field);
}
}
return set;
} | [
"public",
"static",
"Set",
"<",
"Field",
">",
"getFieldsAnnotatedBy",
"(",
"Class",
"<",
"?",
">",
"classs",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"ann",
")",
"{",
"Set",
"<",
"Field",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
")"... | Gets all fields annotated by annotation.
@param classs class to get fields from
@param ann annotation that must be present on the field
@return set of fields | [
"Gets",
"all",
"fields",
"annotated",
"by",
"annotation",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/Reflection.java#L72-L80 |
49,527 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/Reflection.java | Reflection.getMethodsAnnotatedBy | public static Set<Method> getMethodsAnnotatedBy(
Class<?> classs, Class<? extends Annotation> ann) {
Set<Method> set = new HashSet<>();
for (Method method : getAllMethods(classs)) {
if (method.isAnnotationPresent(ann)) {
set.add(method);
}
}
return set;
} | java | public static Set<Method> getMethodsAnnotatedBy(
Class<?> classs, Class<? extends Annotation> ann) {
Set<Method> set = new HashSet<>();
for (Method method : getAllMethods(classs)) {
if (method.isAnnotationPresent(ann)) {
set.add(method);
}
}
return set;
} | [
"public",
"static",
"Set",
"<",
"Method",
">",
"getMethodsAnnotatedBy",
"(",
"Class",
"<",
"?",
">",
"classs",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"ann",
")",
"{",
"Set",
"<",
"Method",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
... | Gets all methods annotated by annotation.
@param classs class to get fields from
@param ann annotation that must be present on the method
@return set of methods | [
"Gets",
"all",
"methods",
"annotated",
"by",
"annotation",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/Reflection.java#L89-L98 |
49,528 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/AbstractContextualMonitor.java | AbstractContextualMonitor.getMonitorForCurrentContext | protected M getMonitorForCurrentContext() {
MonitorConfig contextConfig = getConfig();
M monitor = monitors.get(contextConfig);
if (monitor == null) {
M newMon = newMonitor.apply(contextConfig);
if (newMon instanceof SpectatorMonitor) {
((SpectatorMonitor) newMon).initializeSpectator(spe... | java | protected M getMonitorForCurrentContext() {
MonitorConfig contextConfig = getConfig();
M monitor = monitors.get(contextConfig);
if (monitor == null) {
M newMon = newMonitor.apply(contextConfig);
if (newMon instanceof SpectatorMonitor) {
((SpectatorMonitor) newMon).initializeSpectator(spe... | [
"protected",
"M",
"getMonitorForCurrentContext",
"(",
")",
"{",
"MonitorConfig",
"contextConfig",
"=",
"getConfig",
"(",
")",
";",
"M",
"monitor",
"=",
"monitors",
".",
"get",
"(",
"contextConfig",
")",
";",
"if",
"(",
"monitor",
"==",
"null",
")",
"{",
"M... | Returns a monitor instance for the current context. If no monitor exists for the current
context then a new one will be created. | [
"Returns",
"a",
"monitor",
"instance",
"for",
"the",
"current",
"context",
".",
"If",
"no",
"monitor",
"exists",
"for",
"the",
"current",
"context",
"then",
"a",
"new",
"one",
"will",
"be",
"created",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/AbstractContextualMonitor.java#L97-L111 |
49,529 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/tag/Tags.java | Tags.internCustom | static Tag internCustom(Tag t) {
return (t instanceof BasicTag) ? t : newTag(t.getKey(), t.getValue());
} | java | static Tag internCustom(Tag t) {
return (t instanceof BasicTag) ? t : newTag(t.getKey(), t.getValue());
} | [
"static",
"Tag",
"internCustom",
"(",
"Tag",
"t",
")",
"{",
"return",
"(",
"t",
"instanceof",
"BasicTag",
")",
"?",
"t",
":",
"newTag",
"(",
"t",
".",
"getKey",
"(",
")",
",",
"t",
".",
"getValue",
"(",
")",
")",
";",
"}"
] | Interns custom tag types, assumes that basic tags are already interned. This is used to
ensure that we have a common view of tags internally. In particular, different subclasses of
Tag may not be equal even if they have the same key and value. Tag lists should use this to
ensure the equality will work as expected. | [
"Interns",
"custom",
"tag",
"types",
"assumes",
"that",
"basic",
"tags",
"are",
"already",
"interned",
".",
"This",
"is",
"used",
"to",
"ensure",
"that",
"we",
"have",
"a",
"common",
"view",
"of",
"tags",
"internally",
".",
"In",
"particular",
"different",
... | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/tag/Tags.java#L55-L57 |
49,530 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/tag/Tags.java | Tags.newTag | public static Tag newTag(String key, String value) {
Tag newTag = new BasicTag(intern(key), intern(value));
return intern(newTag);
} | java | public static Tag newTag(String key, String value) {
Tag newTag = new BasicTag(intern(key), intern(value));
return intern(newTag);
} | [
"public",
"static",
"Tag",
"newTag",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"Tag",
"newTag",
"=",
"new",
"BasicTag",
"(",
"intern",
"(",
"key",
")",
",",
"intern",
"(",
"value",
")",
")",
";",
"return",
"intern",
"(",
"newTag",
")",
... | Create a new tag instance. | [
"Create",
"a",
"new",
"tag",
"instance",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/tag/Tags.java#L62-L65 |
49,531 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/BucketConfig.java | BucketConfig.getTimeUnitAbbreviation | public String getTimeUnitAbbreviation() {
switch (timeUnit) {
case DAYS:
return "day";
case HOURS:
return "hr";
case MICROSECONDS:
return "\u00B5s";
case MILLISECONDS:
return "ms";
case MINUTES:
return "min";
case NANOSECONDS:
retur... | java | public String getTimeUnitAbbreviation() {
switch (timeUnit) {
case DAYS:
return "day";
case HOURS:
return "hr";
case MICROSECONDS:
return "\u00B5s";
case MILLISECONDS:
return "ms";
case MINUTES:
return "min";
case NANOSECONDS:
retur... | [
"public",
"String",
"getTimeUnitAbbreviation",
"(",
")",
"{",
"switch",
"(",
"timeUnit",
")",
"{",
"case",
"DAYS",
":",
"return",
"\"day\"",
";",
"case",
"HOURS",
":",
"return",
"\"hr\"",
";",
"case",
"MICROSECONDS",
":",
"return",
"\"\\u00B5s\"",
";",
"case... | Returns an abbreviation for the Bucket's TimeUnit. | [
"Returns",
"an",
"abbreviation",
"for",
"the",
"Bucket",
"s",
"TimeUnit",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/BucketConfig.java#L121-L140 |
49,532 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/ThreadCpuStats.java | ThreadCpuStats.start | public synchronized void start() {
if (!running) {
running = true;
Thread t = new Thread(new CpuStatRunnable(), "ThreadCpuStatsCollector");
t.setDaemon(true);
t.start();
}
} | java | public synchronized void start() {
if (!running) {
running = true;
Thread t = new Thread(new CpuStatRunnable(), "ThreadCpuStatsCollector");
t.setDaemon(true);
t.start();
}
} | [
"public",
"synchronized",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"!",
"running",
")",
"{",
"running",
"=",
"true",
";",
"Thread",
"t",
"=",
"new",
"Thread",
"(",
"new",
"CpuStatRunnable",
"(",
")",
",",
"\"ThreadCpuStatsCollector\"",
")",
";",
"t",
... | Start collecting cpu stats for the threads. | [
"Start",
"collecting",
"cpu",
"stats",
"for",
"the",
"threads",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/ThreadCpuStats.java#L133-L140 |
49,533 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/ThreadCpuStats.java | ThreadCpuStats.toDuration | public static String toDuration(long inputTime) {
final long second = 1000000000L;
final long minute = 60 * second;
final long hour = 60 * minute;
final long day = 24 * hour;
final long week = 7 * day;
long time = inputTime;
final StringBuilder buf = new StringBuilder();
buf.append('P')... | java | public static String toDuration(long inputTime) {
final long second = 1000000000L;
final long minute = 60 * second;
final long hour = 60 * minute;
final long day = 24 * hour;
final long week = 7 * day;
long time = inputTime;
final StringBuilder buf = new StringBuilder();
buf.append('P')... | [
"public",
"static",
"String",
"toDuration",
"(",
"long",
"inputTime",
")",
"{",
"final",
"long",
"second",
"=",
"1000000000L",
";",
"final",
"long",
"minute",
"=",
"60",
"*",
"second",
";",
"final",
"long",
"hour",
"=",
"60",
"*",
"minute",
";",
"final",... | Convert time in nanoseconds to a duration string. This is used to provide a more human
readable order of magnitude for the duration. We assume standard fixed size quantities for
all units. | [
"Convert",
"time",
"in",
"nanoseconds",
"to",
"a",
"duration",
"string",
".",
"This",
"is",
"used",
"to",
"provide",
"a",
"more",
"human",
"readable",
"order",
"of",
"magnitude",
"for",
"the",
"duration",
".",
"We",
"assume",
"standard",
"fixed",
"size",
"... | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/ThreadCpuStats.java#L185-L202 |
49,534 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/ThreadCpuStats.java | ThreadCpuStats.printThreadCpuUsages | public void printThreadCpuUsages(OutputStream out, CpuUsageComparator cmp) {
final PrintWriter writer = getPrintWriter(out);
final Map<String, Object> threadCpuUsages = getThreadCpuUsages(cmp);
writer.printf("Time: %s%n%n", new Date((Long) threadCpuUsages.get(CURRENT_TIME)));
final long uptimeMillis = ... | java | public void printThreadCpuUsages(OutputStream out, CpuUsageComparator cmp) {
final PrintWriter writer = getPrintWriter(out);
final Map<String, Object> threadCpuUsages = getThreadCpuUsages(cmp);
writer.printf("Time: %s%n%n", new Date((Long) threadCpuUsages.get(CURRENT_TIME)));
final long uptimeMillis = ... | [
"public",
"void",
"printThreadCpuUsages",
"(",
"OutputStream",
"out",
",",
"CpuUsageComparator",
"cmp",
")",
"{",
"final",
"PrintWriter",
"writer",
"=",
"getPrintWriter",
"(",
"out",
")",
";",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"threadCpuUsages",... | Utility function that dumps the cpu usages for the threads to stdout. Output will be sorted
based on the 1-minute usage from highest to lowest.
@param out stream where output will be written
@param cmp order to use for the results | [
"Utility",
"function",
"that",
"dumps",
"the",
"cpu",
"usages",
"for",
"the",
"threads",
"to",
"stdout",
".",
"Output",
"will",
"be",
"sorted",
"based",
"on",
"the",
"1",
"-",
"minute",
"usage",
"from",
"highest",
"to",
"lowest",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/ThreadCpuStats.java#L282-L338 |
49,535 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/ThreadCpuStats.java | ThreadCpuStats.updateStats | private void updateStats() {
final ThreadMXBean bean = ManagementFactory.getThreadMXBean();
if (bean.isThreadCpuTimeEnabled()) {
// Update stats for all current threads
final long[] ids = bean.getAllThreadIds();
Arrays.sort(ids);
long totalCpuTime = 0L;
for (long id : ids) {
... | java | private void updateStats() {
final ThreadMXBean bean = ManagementFactory.getThreadMXBean();
if (bean.isThreadCpuTimeEnabled()) {
// Update stats for all current threads
final long[] ids = bean.getAllThreadIds();
Arrays.sort(ids);
long totalCpuTime = 0L;
for (long id : ids) {
... | [
"private",
"void",
"updateStats",
"(",
")",
"{",
"final",
"ThreadMXBean",
"bean",
"=",
"ManagementFactory",
".",
"getThreadMXBean",
"(",
")",
";",
"if",
"(",
"bean",
".",
"isThreadCpuTimeEnabled",
"(",
")",
")",
"{",
"// Update stats for all current threads",
"fin... | Update the stats for all threads and the jvm. | [
"Update",
"the",
"stats",
"for",
"all",
"threads",
"and",
"the",
"jvm",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/ThreadCpuStats.java#L349-L407 |
49,536 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/TimeLimiter.java | TimeLimiter.callWithTimeout | public <T> T callWithTimeout(Callable<T> callable, long duration, TimeUnit unit)
throws Exception {
Future<T> future = executor.submit(callable);
try {
return future.get(duration, unit);
} catch (InterruptedException e) {
future.cancel(true);
throw e;
} catch (ExecutionException ... | java | public <T> T callWithTimeout(Callable<T> callable, long duration, TimeUnit unit)
throws Exception {
Future<T> future = executor.submit(callable);
try {
return future.get(duration, unit);
} catch (InterruptedException e) {
future.cancel(true);
throw e;
} catch (ExecutionException ... | [
"public",
"<",
"T",
">",
"T",
"callWithTimeout",
"(",
"Callable",
"<",
"T",
">",
"callable",
",",
"long",
"duration",
",",
"TimeUnit",
"unit",
")",
"throws",
"Exception",
"{",
"Future",
"<",
"T",
">",
"future",
"=",
"executor",
".",
"submit",
"(",
"cal... | Invokes a specified Callable, timing out after the specified time limit.
If the target method call finished before the limit is reached, the return
value or exception is propagated to the caller exactly as-is. If, on the
other hand, the time limit is reached, we attempt to abort the call to the
Callable and throw an e... | [
"Invokes",
"a",
"specified",
"Callable",
"timing",
"out",
"after",
"the",
"specified",
"time",
"limit",
".",
"If",
"the",
"target",
"method",
"call",
"finished",
"before",
"the",
"limit",
"is",
"reached",
"the",
"return",
"value",
"or",
"exception",
"is",
"p... | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/TimeLimiter.java#L48-L72 |
49,537 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.newTimer | public static Timer newTimer(String name, TimeUnit unit) {
return new BasicTimer(MonitorConfig.builder(name).build(), unit);
} | java | public static Timer newTimer(String name, TimeUnit unit) {
return new BasicTimer(MonitorConfig.builder(name).build(), unit);
} | [
"public",
"static",
"Timer",
"newTimer",
"(",
"String",
"name",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"new",
"BasicTimer",
"(",
"MonitorConfig",
".",
"builder",
"(",
"name",
")",
".",
"build",
"(",
")",
",",
"unit",
")",
";",
"}"
] | Create a new timer with only the name specified. | [
"Create",
"a",
"new",
"timer",
"with",
"only",
"the",
"name",
"specified",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L97-L99 |
49,538 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.newCounter | public static Counter newCounter(String name, TaggingContext context) {
final MonitorConfig config = MonitorConfig.builder(name).build();
return new ContextualCounter(config, context, COUNTER_FUNCTION);
} | java | public static Counter newCounter(String name, TaggingContext context) {
final MonitorConfig config = MonitorConfig.builder(name).build();
return new ContextualCounter(config, context, COUNTER_FUNCTION);
} | [
"public",
"static",
"Counter",
"newCounter",
"(",
"String",
"name",
",",
"TaggingContext",
"context",
")",
"{",
"final",
"MonitorConfig",
"config",
"=",
"MonitorConfig",
".",
"builder",
"(",
"name",
")",
".",
"build",
"(",
")",
";",
"return",
"new",
"Context... | Create a new counter with a name and context. The returned counter will maintain separate
sub-monitors for each distinct set of tags returned from the context on an update operation. | [
"Create",
"a",
"new",
"counter",
"with",
"a",
"name",
"and",
"context",
".",
"The",
"returned",
"counter",
"will",
"maintain",
"separate",
"sub",
"-",
"monitors",
"for",
"each",
"distinct",
"set",
"of",
"tags",
"returned",
"from",
"the",
"context",
"on",
"... | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L121-L124 |
49,539 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.newObjectMonitor | public static CompositeMonitor<?> newObjectMonitor(String id, Object obj) {
final TagList tags = getMonitorTags(obj);
List<Monitor<?>> monitors = new ArrayList<>();
addMonitors(monitors, id, tags, obj);
final Class<?> c = obj.getClass();
final String objectId = (id == null) ? DEFAULT_ID : id;
... | java | public static CompositeMonitor<?> newObjectMonitor(String id, Object obj) {
final TagList tags = getMonitorTags(obj);
List<Monitor<?>> monitors = new ArrayList<>();
addMonitors(monitors, id, tags, obj);
final Class<?> c = obj.getClass();
final String objectId = (id == null) ? DEFAULT_ID : id;
... | [
"public",
"static",
"CompositeMonitor",
"<",
"?",
">",
"newObjectMonitor",
"(",
"String",
"id",
",",
"Object",
"obj",
")",
"{",
"final",
"TagList",
"tags",
"=",
"getMonitorTags",
"(",
"obj",
")",
";",
"List",
"<",
"Monitor",
"<",
"?",
">",
">",
"monitors... | Helper function to easily create a composite for all monitor fields and
annotated attributes of a given object.
@param id a unique id associated with this particular instance of the
object. If multiple objects of the same class are registered
they will have the same config and conflict unless the id
values are distin... | [
"Helper",
"function",
"to",
"easily",
"create",
"a",
"composite",
"for",
"all",
"monitor",
"fields",
"and",
"annotated",
"attributes",
"of",
"a",
"given",
"object",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L149-L158 |
49,540 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.newThreadPoolMonitor | public static CompositeMonitor<?> newThreadPoolMonitor(String id, ThreadPoolExecutor pool) {
return newObjectMonitor(id, new MonitoredThreadPool(pool));
} | java | public static CompositeMonitor<?> newThreadPoolMonitor(String id, ThreadPoolExecutor pool) {
return newObjectMonitor(id, new MonitoredThreadPool(pool));
} | [
"public",
"static",
"CompositeMonitor",
"<",
"?",
">",
"newThreadPoolMonitor",
"(",
"String",
"id",
",",
"ThreadPoolExecutor",
"pool",
")",
"{",
"return",
"newObjectMonitor",
"(",
"id",
",",
"new",
"MonitoredThreadPool",
"(",
"pool",
")",
")",
";",
"}"
] | Creates a new monitor for a thread pool with standard metrics for the pool size, queue size,
task counts, etc.
@param id id to differentiate metrics for this pool from others.
@param pool thread pool instance to monitor.
@return composite monitor based on stats provided for the pool | [
"Creates",
"a",
"new",
"monitor",
"for",
"a",
"thread",
"pool",
"with",
"standard",
"metrics",
"for",
"the",
"pool",
"size",
"queue",
"size",
"task",
"counts",
"etc",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L168-L170 |
49,541 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.newCacheMonitor | public static CompositeMonitor<?> newCacheMonitor(String id, Cache<?, ?> cache) {
return newObjectMonitor(id, new MonitoredCache(cache));
} | java | public static CompositeMonitor<?> newCacheMonitor(String id, Cache<?, ?> cache) {
return newObjectMonitor(id, new MonitoredCache(cache));
} | [
"public",
"static",
"CompositeMonitor",
"<",
"?",
">",
"newCacheMonitor",
"(",
"String",
"id",
",",
"Cache",
"<",
"?",
",",
"?",
">",
"cache",
")",
"{",
"return",
"newObjectMonitor",
"(",
"id",
",",
"new",
"MonitoredCache",
"(",
"cache",
")",
")",
";",
... | Creates a new monitor for a cache with standard metrics for the hits, misses, and loads.
@param id id to differentiate metrics for this cache from others.
@param cache cache instance to monitor.
@return composite monitor based on stats provided for the cache | [
"Creates",
"a",
"new",
"monitor",
"for",
"a",
"cache",
"with",
"standard",
"metrics",
"for",
"the",
"hits",
"misses",
"and",
"loads",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L179-L181 |
49,542 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.isObjectRegistered | public static boolean isObjectRegistered(String id, Object obj) {
return DefaultMonitorRegistry.getInstance().isRegistered(newObjectMonitor(id, obj));
} | java | public static boolean isObjectRegistered(String id, Object obj) {
return DefaultMonitorRegistry.getInstance().isRegistered(newObjectMonitor(id, obj));
} | [
"public",
"static",
"boolean",
"isObjectRegistered",
"(",
"String",
"id",
",",
"Object",
"obj",
")",
"{",
"return",
"DefaultMonitorRegistry",
".",
"getInstance",
"(",
")",
".",
"isRegistered",
"(",
"newObjectMonitor",
"(",
"id",
",",
"obj",
")",
")",
";",
"}... | Check whether an object is currently registered with the default registry. | [
"Check",
"whether",
"an",
"object",
"is",
"currently",
"registered",
"with",
"the",
"default",
"registry",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L229-L231 |
49,543 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.wrap | @SuppressWarnings("unchecked")
static <T> Monitor<T> wrap(TagList tags, Monitor<T> monitor) {
Monitor<T> m;
if (monitor instanceof CompositeMonitor<?>) {
m = new CompositeMonitorWrapper<>(tags, (CompositeMonitor<T>) monitor);
} else {
m = MonitorWrapper.create(tags, monitor);
}
return ... | java | @SuppressWarnings("unchecked")
static <T> Monitor<T> wrap(TagList tags, Monitor<T> monitor) {
Monitor<T> m;
if (monitor instanceof CompositeMonitor<?>) {
m = new CompositeMonitorWrapper<>(tags, (CompositeMonitor<T>) monitor);
} else {
m = MonitorWrapper.create(tags, monitor);
}
return ... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"T",
">",
"Monitor",
"<",
"T",
">",
"wrap",
"(",
"TagList",
"tags",
",",
"Monitor",
"<",
"T",
">",
"monitor",
")",
"{",
"Monitor",
"<",
"T",
">",
"m",
";",
"if",
"(",
"monitor",
"in... | Returns a new monitor that adds the provided tags to the configuration returned by the
wrapped monitor. | [
"Returns",
"a",
"new",
"monitor",
"that",
"adds",
"the",
"provided",
"tags",
"to",
"the",
"configuration",
"returned",
"by",
"the",
"wrapped",
"monitor",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L237-L246 |
49,544 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.addMonitors | static void addMonitors(List<Monitor<?>> monitors, String id, TagList tags, Object obj) {
addMonitorFields(monitors, id, tags, obj);
addAnnotatedFields(monitors, id, tags, obj);
} | java | static void addMonitors(List<Monitor<?>> monitors, String id, TagList tags, Object obj) {
addMonitorFields(monitors, id, tags, obj);
addAnnotatedFields(monitors, id, tags, obj);
} | [
"static",
"void",
"addMonitors",
"(",
"List",
"<",
"Monitor",
"<",
"?",
">",
">",
"monitors",
",",
"String",
"id",
",",
"TagList",
"tags",
",",
"Object",
"obj",
")",
"{",
"addMonitorFields",
"(",
"monitors",
",",
"id",
",",
"tags",
",",
"obj",
")",
"... | Extract all monitors across class hierarchy. | [
"Extract",
"all",
"monitors",
"across",
"class",
"hierarchy",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L251-L254 |
49,545 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.getMonitorTags | private static TagList getMonitorTags(Object obj) {
try {
Set<Field> fields = getFieldsAnnotatedBy(obj.getClass(), MonitorTags.class);
for (Field field : fields) {
field.setAccessible(true);
return (TagList) field.get(obj);
}
Set<Method> methods = getMethodsAnnotatedBy(obj.g... | java | private static TagList getMonitorTags(Object obj) {
try {
Set<Field> fields = getFieldsAnnotatedBy(obj.getClass(), MonitorTags.class);
for (Field field : fields) {
field.setAccessible(true);
return (TagList) field.get(obj);
}
Set<Method> methods = getMethodsAnnotatedBy(obj.g... | [
"private",
"static",
"TagList",
"getMonitorTags",
"(",
"Object",
"obj",
")",
"{",
"try",
"{",
"Set",
"<",
"Field",
">",
"fields",
"=",
"getFieldsAnnotatedBy",
"(",
"obj",
".",
"getClass",
"(",
")",
",",
"MonitorTags",
".",
"class",
")",
";",
"for",
"(",
... | Get tags from annotation. | [
"Get",
"tags",
"from",
"annotation",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L338-L356 |
49,546 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.checkType | private static void checkType(
com.netflix.servo.annotations.Monitor anno, Class<?> type, Class<?> container) {
if (!isNumericType(type)) {
final String msg = "annotation of type " + anno.type().name() + " can only be used"
+ " with numeric values, " + anno.name() + " in class " + container.ge... | java | private static void checkType(
com.netflix.servo.annotations.Monitor anno, Class<?> type, Class<?> container) {
if (!isNumericType(type)) {
final String msg = "annotation of type " + anno.type().name() + " can only be used"
+ " with numeric values, " + anno.name() + " in class " + container.ge... | [
"private",
"static",
"void",
"checkType",
"(",
"com",
".",
"netflix",
".",
"servo",
".",
"annotations",
".",
"Monitor",
"anno",
",",
"Class",
"<",
"?",
">",
"type",
",",
"Class",
"<",
"?",
">",
"container",
")",
"{",
"if",
"(",
"!",
"isNumericType",
... | Verify that the type for the annotated field is numeric. | [
"Verify",
"that",
"the",
"type",
"for",
"the",
"annotated",
"field",
"is",
"numeric",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L361-L369 |
49,547 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.newObjectConfig | private static MonitorConfig newObjectConfig(Class<?> c, String id, TagList tags) {
final MonitorConfig.Builder builder = MonitorConfig.builder(id);
final String className = className(c);
if (!className.isEmpty()) {
builder.withTag("class", className);
}
if (tags != null) {
builder.with... | java | private static MonitorConfig newObjectConfig(Class<?> c, String id, TagList tags) {
final MonitorConfig.Builder builder = MonitorConfig.builder(id);
final String className = className(c);
if (!className.isEmpty()) {
builder.withTag("class", className);
}
if (tags != null) {
builder.with... | [
"private",
"static",
"MonitorConfig",
"newObjectConfig",
"(",
"Class",
"<",
"?",
">",
"c",
",",
"String",
"id",
",",
"TagList",
"tags",
")",
"{",
"final",
"MonitorConfig",
".",
"Builder",
"builder",
"=",
"MonitorConfig",
".",
"builder",
"(",
"id",
")",
";"... | Creates a monitor config for a composite object. | [
"Creates",
"a",
"monitor",
"config",
"for",
"a",
"composite",
"object",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L394-L405 |
49,548 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.newConfig | private static MonitorConfig newConfig(
Class<?> c,
String defaultName,
String id,
com.netflix.servo.annotations.Monitor anno,
TagList tags) {
String name = anno.name();
if (name.isEmpty()) {
name = defaultName;
}
MonitorConfig.Builder builder = MonitorConfig.builder(... | java | private static MonitorConfig newConfig(
Class<?> c,
String defaultName,
String id,
com.netflix.servo.annotations.Monitor anno,
TagList tags) {
String name = anno.name();
if (name.isEmpty()) {
name = defaultName;
}
MonitorConfig.Builder builder = MonitorConfig.builder(... | [
"private",
"static",
"MonitorConfig",
"newConfig",
"(",
"Class",
"<",
"?",
">",
"c",
",",
"String",
"defaultName",
",",
"String",
"id",
",",
"com",
".",
"netflix",
".",
"servo",
".",
"annotations",
".",
"Monitor",
"anno",
",",
"TagList",
"tags",
")",
"{"... | Creates a monitor config based on an annotation. | [
"Creates",
"a",
"monitor",
"config",
"based",
"on",
"an",
"annotation",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L416-L437 |
49,549 | Netflix/servo | servo-graphite/src/main/java/com/netflix/servo/publish/graphite/GraphiteMetricObserver.java | GraphiteMetricObserver.stop | public void stop() {
try {
if (socket != null) {
socket.close();
socket = null;
LOGGER.info("Disconnected from graphite server: {}", graphiteServerURI);
}
} catch (IOException e) {
LOGGER.warn("Error Stopping", e);
}
} | java | public void stop() {
try {
if (socket != null) {
socket.close();
socket = null;
LOGGER.info("Disconnected from graphite server: {}", graphiteServerURI);
}
} catch (IOException e) {
LOGGER.warn("Error Stopping", e);
}
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"socket",
"!=",
"null",
")",
"{",
"socket",
".",
"close",
"(",
")",
";",
"socket",
"=",
"null",
";",
"LOGGER",
".",
"info",
"(",
"\"Disconnected from graphite server: {}\"",
",",
"graphiteSe... | Stop sending metrics to the graphite server. | [
"Stop",
"sending",
"metrics",
"to",
"the",
"graphite",
"server",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-graphite/src/main/java/com/netflix/servo/publish/graphite/GraphiteMetricObserver.java#L88-L98 |
49,550 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/tag/SmallTagMap.java | SmallTagMap.get | public Tag get(String key) {
int idx = binarySearch(tagArray, key);
if (idx < 0) {
return null;
} else {
return tagArray[idx];
}
} | java | public Tag get(String key) {
int idx = binarySearch(tagArray, key);
if (idx < 0) {
return null;
} else {
return tagArray[idx];
}
} | [
"public",
"Tag",
"get",
"(",
"String",
"key",
")",
"{",
"int",
"idx",
"=",
"binarySearch",
"(",
"tagArray",
",",
"key",
")",
";",
"if",
"(",
"idx",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"tagArray",
"[",
"idx",
"]"... | Get the tag associated with a given key. | [
"Get",
"the",
"tag",
"associated",
"with",
"a",
"given",
"key",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/tag/SmallTagMap.java#L239-L246 |
49,551 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/stats/StatsBuffer.java | StatsBuffer.record | public void record(long n) {
values[Integer.remainderUnsigned(pos++, size)] = n;
if (curSize < size) {
++curSize;
}
} | java | public void record(long n) {
values[Integer.remainderUnsigned(pos++, size)] = n;
if (curSize < size) {
++curSize;
}
} | [
"public",
"void",
"record",
"(",
"long",
"n",
")",
"{",
"values",
"[",
"Integer",
".",
"remainderUnsigned",
"(",
"pos",
"++",
",",
"size",
")",
"]",
"=",
"n",
";",
"if",
"(",
"curSize",
"<",
"size",
")",
"{",
"++",
"curSize",
";",
"}",
"}"
] | Record a new value for this buffer. | [
"Record",
"a",
"new",
"value",
"for",
"this",
"buffer",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/stats/StatsBuffer.java#L95-L100 |
49,552 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/stats/StatsBuffer.java | StatsBuffer.computeStats | public void computeStats() {
if (statsComputed.getAndSet(true)) {
return;
}
if (curSize == 0) {
return;
}
Arrays.sort(values, 0, curSize); // to compute percentileValues
min = values[0];
max = values[curSize - 1];
total = 0L;
double sumSquares = 0.0;
for (int i = 0... | java | public void computeStats() {
if (statsComputed.getAndSet(true)) {
return;
}
if (curSize == 0) {
return;
}
Arrays.sort(values, 0, curSize); // to compute percentileValues
min = values[0];
max = values[curSize - 1];
total = 0L;
double sumSquares = 0.0;
for (int i = 0... | [
"public",
"void",
"computeStats",
"(",
")",
"{",
"if",
"(",
"statsComputed",
".",
"getAndSet",
"(",
"true",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"curSize",
"==",
"0",
")",
"{",
"return",
";",
"}",
"Arrays",
".",
"sort",
"(",
"values",
",",... | Compute stats for the current set of values. | [
"Compute",
"stats",
"for",
"the",
"current",
"set",
"of",
"values",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/stats/StatsBuffer.java#L105-L133 |
49,553 | Netflix/servo | servo-aws/src/main/java/com/netflix/servo/publish/cloudwatch/CloudWatchMetricObserver.java | CloudWatchMetricObserver.truncate | Double truncate(Number numberValue) {
// http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html
double doubleValue = numberValue.doubleValue();
if (truncateEnabled) {
final int exponent = Math.getExponent(doubleValue);
if (Double.isNaN(doubleValue)) {
... | java | Double truncate(Number numberValue) {
// http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html
double doubleValue = numberValue.doubleValue();
if (truncateEnabled) {
final int exponent = Math.getExponent(doubleValue);
if (Double.isNaN(doubleValue)) {
... | [
"Double",
"truncate",
"(",
"Number",
"numberValue",
")",
"{",
"// http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html",
"double",
"doubleValue",
"=",
"numberValue",
".",
"doubleValue",
"(",
")",
";",
"if",
"(",
"truncateEnabled",
")",
... | Adjust a double value so it can be successfully written to cloudwatch. This involves capping
values with large exponents to an experimentally determined max value and converting values
with large negative exponents to 0. In addition, NaN values will be converted to 0. | [
"Adjust",
"a",
"double",
"value",
"so",
"it",
"can",
"be",
"successfully",
"written",
"to",
"cloudwatch",
".",
"This",
"involves",
"capping",
"values",
"with",
"large",
"exponents",
"to",
"an",
"experimentally",
"determined",
"max",
"value",
"and",
"converting",... | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-aws/src/main/java/com/netflix/servo/publish/cloudwatch/CloudWatchMetricObserver.java#L247-L261 |
49,554 | Netflix/servo | servo-atlas/src/main/java/com/netflix/servo/publish/atlas/ValidCharacters.java | ValidCharacters.toValidValue | public static Metric toValidValue(Metric metric) {
MonitorConfig cfg = metric.getConfig();
MonitorConfig.Builder cfgBuilder = MonitorConfig.builder(toValidCharset(cfg.getName()));
for (Tag orig : cfg.getTags()) {
final String key = orig.getKey();
if (RELAXED_GROUP_KEYS.contains(key)) {
c... | java | public static Metric toValidValue(Metric metric) {
MonitorConfig cfg = metric.getConfig();
MonitorConfig.Builder cfgBuilder = MonitorConfig.builder(toValidCharset(cfg.getName()));
for (Tag orig : cfg.getTags()) {
final String key = orig.getKey();
if (RELAXED_GROUP_KEYS.contains(key)) {
c... | [
"public",
"static",
"Metric",
"toValidValue",
"(",
"Metric",
"metric",
")",
"{",
"MonitorConfig",
"cfg",
"=",
"metric",
".",
"getConfig",
"(",
")",
";",
"MonitorConfig",
".",
"Builder",
"cfgBuilder",
"=",
"MonitorConfig",
".",
"builder",
"(",
"toValidCharset",
... | Return a new metric where the name and all tags are using the valid character
set. | [
"Return",
"a",
"new",
"metric",
"where",
"the",
"name",
"and",
"all",
"tags",
"are",
"using",
"the",
"valid",
"character",
"set",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-atlas/src/main/java/com/netflix/servo/publish/atlas/ValidCharacters.java#L112-L125 |
49,555 | Netflix/servo | servo-atlas/src/main/java/com/netflix/servo/publish/atlas/ValidCharacters.java | ValidCharacters.toValidValues | public static List<Metric> toValidValues(List<Metric> metrics) {
return metrics.stream().map(ValidCharacters::toValidValue).collect(Collectors.toList());
} | java | public static List<Metric> toValidValues(List<Metric> metrics) {
return metrics.stream().map(ValidCharacters::toValidValue).collect(Collectors.toList());
} | [
"public",
"static",
"List",
"<",
"Metric",
">",
"toValidValues",
"(",
"List",
"<",
"Metric",
">",
"metrics",
")",
"{",
"return",
"metrics",
".",
"stream",
"(",
")",
".",
"map",
"(",
"ValidCharacters",
"::",
"toValidValue",
")",
".",
"collect",
"(",
"Coll... | Create a new list of metrics where all metrics are using the valid character set. | [
"Create",
"a",
"new",
"list",
"of",
"metrics",
"where",
"all",
"metrics",
"are",
"using",
"the",
"valid",
"character",
"set",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-atlas/src/main/java/com/netflix/servo/publish/atlas/ValidCharacters.java#L130-L132 |
49,556 | Netflix/servo | servo-atlas/src/main/java/com/netflix/servo/publish/atlas/ValidCharacters.java | ValidCharacters.tagToJson | public static void tagToJson(JsonGenerator gen, Tag tag) throws IOException {
final String key = tag.getKey();
if (RELAXED_GROUP_KEYS.contains(key)) {
gen.writeStringField(key, toValidCharsetTable(CHARS_ALLOWED_GROUPS, tag.getValue()));
} else {
gen.writeStringField(toValidCharset(tag.getKey()),... | java | public static void tagToJson(JsonGenerator gen, Tag tag) throws IOException {
final String key = tag.getKey();
if (RELAXED_GROUP_KEYS.contains(key)) {
gen.writeStringField(key, toValidCharsetTable(CHARS_ALLOWED_GROUPS, tag.getValue()));
} else {
gen.writeStringField(toValidCharset(tag.getKey()),... | [
"public",
"static",
"void",
"tagToJson",
"(",
"JsonGenerator",
"gen",
",",
"Tag",
"tag",
")",
"throws",
"IOException",
"{",
"final",
"String",
"key",
"=",
"tag",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"RELAXED_GROUP_KEYS",
".",
"contains",
"(",
"key",
... | Serialize a tag to the given JsonGenerator. | [
"Serialize",
"a",
"tag",
"to",
"the",
"given",
"JsonGenerator",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-atlas/src/main/java/com/netflix/servo/publish/atlas/ValidCharacters.java#L137-L144 |
49,557 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/StatsMonitor.java | StatsMonitor.record | public void record(long measurement) {
lastUsed = clock.now();
if (isExpired()) {
LOGGER.info("Attempting to get the value for an expired monitor: {}."
+ "Will start computing stats again.",
getConfig().getName());
startComputingStats(executor, statsConfig.getFrequencyMillis(... | java | public void record(long measurement) {
lastUsed = clock.now();
if (isExpired()) {
LOGGER.info("Attempting to get the value for an expired monitor: {}."
+ "Will start computing stats again.",
getConfig().getName());
startComputingStats(executor, statsConfig.getFrequencyMillis(... | [
"public",
"void",
"record",
"(",
"long",
"measurement",
")",
"{",
"lastUsed",
"=",
"clock",
".",
"now",
"(",
")",
";",
"if",
"(",
"isExpired",
"(",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Attempting to get the value for an expired monitor: {}.\"",
"+",
... | Record the measurement we want to perform statistics on. | [
"Record",
"the",
"measurement",
"we",
"want",
"to",
"perform",
"statistics",
"on",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/StatsMonitor.java#L444-L458 |
49,558 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/StatsMonitor.java | StatsMonitor.getValue | @Override
public Long getValue(int pollerIndex) {
final long n = getCount(pollerIndex);
return n > 0 ? totalMeasurement.getValue(pollerIndex).longValue() / n : 0L;
} | java | @Override
public Long getValue(int pollerIndex) {
final long n = getCount(pollerIndex);
return n > 0 ? totalMeasurement.getValue(pollerIndex).longValue() / n : 0L;
} | [
"@",
"Override",
"public",
"Long",
"getValue",
"(",
"int",
"pollerIndex",
")",
"{",
"final",
"long",
"n",
"=",
"getCount",
"(",
"pollerIndex",
")",
";",
"return",
"n",
">",
"0",
"?",
"totalMeasurement",
".",
"getValue",
"(",
"pollerIndex",
")",
".",
"lon... | Get the value of the measurement. | [
"Get",
"the",
"value",
"of",
"the",
"measurement",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/StatsMonitor.java#L463-L467 |
49,559 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/ExpiringCache.java | ExpiringCache.values | public List<V> values() {
final Collection<Entry<V>> values = map.values();
// Note below that e.value avoids updating the access time
final List<V> res = values.stream().map(e -> e.value).collect(Collectors.toList());
return Collections.unmodifiableList(res);
} | java | public List<V> values() {
final Collection<Entry<V>> values = map.values();
// Note below that e.value avoids updating the access time
final List<V> res = values.stream().map(e -> e.value).collect(Collectors.toList());
return Collections.unmodifiableList(res);
} | [
"public",
"List",
"<",
"V",
">",
"values",
"(",
")",
"{",
"final",
"Collection",
"<",
"Entry",
"<",
"V",
">",
">",
"values",
"=",
"map",
".",
"values",
"(",
")",
";",
"// Note below that e.value avoids updating the access time",
"final",
"List",
"<",
"V",
... | Get the list of all values that are members of this cache. Does not
affect the access time used for eviction. | [
"Get",
"the",
"list",
"of",
"all",
"values",
"that",
"are",
"members",
"of",
"this",
"cache",
".",
"Does",
"not",
"affect",
"the",
"access",
"time",
"used",
"for",
"eviction",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/ExpiringCache.java#L159-L164 |
49,560 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/publish/PollScheduler.java | PollScheduler.addPoller | public void addPoller(PollRunnable task, long delay, TimeUnit timeUnit) {
ScheduledExecutorService service = executor.get();
if (service != null) {
service.scheduleWithFixedDelay(task, 0, delay, timeUnit);
} else {
throw new IllegalStateException(
"you must start the scheduler before t... | java | public void addPoller(PollRunnable task, long delay, TimeUnit timeUnit) {
ScheduledExecutorService service = executor.get();
if (service != null) {
service.scheduleWithFixedDelay(task, 0, delay, timeUnit);
} else {
throw new IllegalStateException(
"you must start the scheduler before t... | [
"public",
"void",
"addPoller",
"(",
"PollRunnable",
"task",
",",
"long",
"delay",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"ScheduledExecutorService",
"service",
"=",
"executor",
".",
"get",
"(",
")",
";",
"if",
"(",
"service",
"!=",
"null",
")",
"{",
"servi... | Add a tasks to execute at a fixed rate based on the provided delay. | [
"Add",
"a",
"tasks",
"to",
"execute",
"at",
"a",
"fixed",
"rate",
"based",
"on",
"the",
"provided",
"delay",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/publish/PollScheduler.java#L51-L59 |
49,561 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/publish/PollScheduler.java | PollScheduler.start | public void start() {
int numThreads = Runtime.getRuntime().availableProcessors();
ThreadFactory factory = ThreadFactories.withName("ServoPollScheduler-%d");
start(Executors.newScheduledThreadPool(numThreads, factory));
} | java | public void start() {
int numThreads = Runtime.getRuntime().availableProcessors();
ThreadFactory factory = ThreadFactories.withName("ServoPollScheduler-%d");
start(Executors.newScheduledThreadPool(numThreads, factory));
} | [
"public",
"void",
"start",
"(",
")",
"{",
"int",
"numThreads",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"availableProcessors",
"(",
")",
";",
"ThreadFactory",
"factory",
"=",
"ThreadFactories",
".",
"withName",
"(",
"\"ServoPollScheduler-%d\"",
")",
"... | Start scheduling tasks with a default thread pool, sized based on the
number of available processors. | [
"Start",
"scheduling",
"tasks",
"with",
"a",
"default",
"thread",
"pool",
"sized",
"based",
"on",
"the",
"number",
"of",
"available",
"processors",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/publish/PollScheduler.java#L65-L69 |
49,562 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/publish/PollScheduler.java | PollScheduler.stop | public void stop() {
ScheduledExecutorService service = executor.get();
if (service != null && executor.compareAndSet(service, null)) {
service.shutdown();
} else {
throw new IllegalStateException("scheduler must be started before you stop it");
}
} | java | public void stop() {
ScheduledExecutorService service = executor.get();
if (service != null && executor.compareAndSet(service, null)) {
service.shutdown();
} else {
throw new IllegalStateException("scheduler must be started before you stop it");
}
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"ScheduledExecutorService",
"service",
"=",
"executor",
".",
"get",
"(",
")",
";",
"if",
"(",
"service",
"!=",
"null",
"&&",
"executor",
".",
"compareAndSet",
"(",
"service",
",",
"null",
")",
")",
"{",
"service",... | Stop the poller, shutting down the current executor service. | [
"Stop",
"the",
"poller",
"shutting",
"down",
"the",
"current",
"executor",
"service",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/publish/PollScheduler.java#L83-L90 |
49,563 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/Strings.java | Strings.join | public static String join(String separator, Iterator<?> parts) {
Preconditions.checkNotNull(separator, "separator");
Preconditions.checkNotNull(parts, "parts");
StringBuilder builder = new StringBuilder();
if (parts.hasNext()) {
builder.append(parts.next().toString());
while (parts.hasNext(... | java | public static String join(String separator, Iterator<?> parts) {
Preconditions.checkNotNull(separator, "separator");
Preconditions.checkNotNull(parts, "parts");
StringBuilder builder = new StringBuilder();
if (parts.hasNext()) {
builder.append(parts.next().toString());
while (parts.hasNext(... | [
"public",
"static",
"String",
"join",
"(",
"String",
"separator",
",",
"Iterator",
"<",
"?",
">",
"parts",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"separator",
",",
"\"separator\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"parts",
"... | Join the string representation of each part separated by the given separator string.
@param separator Separator string. For example ","
@param parts An iterator of the parts to join
@return The string formed by joining each part separated by the given separator. | [
"Join",
"the",
"string",
"representation",
"of",
"each",
"part",
"separated",
"by",
"the",
"given",
"separator",
"string",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/Strings.java#L41-L54 |
49,564 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/util/Preconditions.java | Preconditions.checkNotNull | public static <T> T checkNotNull(T obj, String name) {
if (obj == null) {
String msg = String.format("parameter '%s' cannot be null", name);
throw new NullPointerException(msg);
}
return obj;
} | java | public static <T> T checkNotNull(T obj, String name) {
if (obj == null) {
String msg = String.format("parameter '%s' cannot be null", name);
throw new NullPointerException(msg);
}
return obj;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"T",
"obj",
",",
"String",
"name",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"String",
"msg",
"=",
"String",
".",
"format",
"(",
"\"parameter '%s' cannot be null\"",
",",
"name",
")... | Ensures the object reference is not null. | [
"Ensures",
"the",
"object",
"reference",
"is",
"not",
"null",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/Preconditions.java#L30-L36 |
49,565 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/MinGauge.java | MinGauge.update | public void update(long v) {
for (int i = 0; i < Pollers.NUM_POLLERS; ++i) {
updateMin(i, v);
}
} | java | public void update(long v) {
for (int i = 0; i < Pollers.NUM_POLLERS; ++i) {
updateMin(i, v);
}
} | [
"public",
"void",
"update",
"(",
"long",
"v",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"Pollers",
".",
"NUM_POLLERS",
";",
"++",
"i",
")",
"{",
"updateMin",
"(",
"i",
",",
"v",
")",
";",
"}",
"}"
] | Update the min if the provided value is smaller than the current min. | [
"Update",
"the",
"min",
"if",
"the",
"provided",
"value",
"is",
"smaller",
"than",
"the",
"current",
"min",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/MinGauge.java#L62-L66 |
49,566 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/MinGauge.java | MinGauge.getCurrentValue | public long getCurrentValue(int nth) {
long v = min.getCurrent(nth).get();
return (v == Long.MAX_VALUE) ? 0L : v;
} | java | public long getCurrentValue(int nth) {
long v = min.getCurrent(nth).get();
return (v == Long.MAX_VALUE) ? 0L : v;
} | [
"public",
"long",
"getCurrentValue",
"(",
"int",
"nth",
")",
"{",
"long",
"v",
"=",
"min",
".",
"getCurrent",
"(",
"nth",
")",
".",
"get",
"(",
")",
";",
"return",
"(",
"v",
"==",
"Long",
".",
"MAX_VALUE",
")",
"?",
"0L",
":",
"v",
";",
"}"
] | Returns the current min value since the last reset. | [
"Returns",
"the",
"current",
"min",
"value",
"since",
"the",
"last",
"reset",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/MinGauge.java#L80-L83 |
49,567 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/publish/MemoryMetricObserver.java | MemoryMetricObserver.getObservations | public List<List<Metric>> getObservations() {
List<List<Metric>> builder = new ArrayList<>();
int pos = next;
for (List<Metric> ignored : observations) {
if (observations[pos] != null) {
builder.add(observations[pos]);
}
pos = (pos + 1) % observations.length;
}
return Colle... | java | public List<List<Metric>> getObservations() {
List<List<Metric>> builder = new ArrayList<>();
int pos = next;
for (List<Metric> ignored : observations) {
if (observations[pos] != null) {
builder.add(observations[pos]);
}
pos = (pos + 1) % observations.length;
}
return Colle... | [
"public",
"List",
"<",
"List",
"<",
"Metric",
">",
">",
"getObservations",
"(",
")",
"{",
"List",
"<",
"List",
"<",
"Metric",
">>",
"builder",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"pos",
"=",
"next",
";",
"for",
"(",
"List",
"<",
... | Returns the current set of observations. | [
"Returns",
"the",
"current",
"set",
"of",
"observations",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/publish/MemoryMetricObserver.java#L62-L72 |
49,568 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/MonitorConfig.java | MonitorConfig.copy | private MonitorConfig.Builder copy() {
return MonitorConfig.builder(name).withTags(tags).withPublishingPolicy(policy);
} | java | private MonitorConfig.Builder copy() {
return MonitorConfig.builder(name).withTags(tags).withPublishingPolicy(policy);
} | [
"private",
"MonitorConfig",
".",
"Builder",
"copy",
"(",
")",
"{",
"return",
"MonitorConfig",
".",
"builder",
"(",
"name",
")",
".",
"withTags",
"(",
"tags",
")",
".",
"withPublishingPolicy",
"(",
"policy",
")",
";",
"}"
] | Returns a copy of the current MonitorConfig. | [
"Returns",
"a",
"copy",
"of",
"the",
"current",
"MonitorConfig",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/MonitorConfig.java#L236-L238 |
49,569 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/MaxGauge.java | MaxGauge.update | public void update(long v) {
spectatorGauge.set(v);
for (int i = 0; i < Pollers.NUM_POLLERS; ++i) {
updateMax(i, v);
}
} | java | public void update(long v) {
spectatorGauge.set(v);
for (int i = 0; i < Pollers.NUM_POLLERS; ++i) {
updateMax(i, v);
}
} | [
"public",
"void",
"update",
"(",
"long",
"v",
")",
"{",
"spectatorGauge",
".",
"set",
"(",
"v",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"Pollers",
".",
"NUM_POLLERS",
";",
"++",
"i",
")",
"{",
"updateMax",
"(",
"i",
",",
"v",... | Update the max if the provided value is larger than the current max. | [
"Update",
"the",
"max",
"if",
"the",
"provided",
"value",
"is",
"larger",
"than",
"the",
"current",
"max",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/MaxGauge.java#L71-L76 |
49,570 | Netflix/servo | servo-atlas/src/main/java/com/netflix/servo/publish/atlas/HttpHelper.java | HttpHelper.sendAll | public int sendAll(Iterable<Observable<Integer>> batches,
final int numMetrics, long timeoutMillis) {
final AtomicBoolean err = new AtomicBoolean(false);
final AtomicInteger updated = new AtomicInteger(0);
LOGGER.debug("Got {} ms to send {} metrics", timeoutMillis, numMetrics);
try ... | java | public int sendAll(Iterable<Observable<Integer>> batches,
final int numMetrics, long timeoutMillis) {
final AtomicBoolean err = new AtomicBoolean(false);
final AtomicInteger updated = new AtomicInteger(0);
LOGGER.debug("Got {} ms to send {} metrics", timeoutMillis, numMetrics);
try ... | [
"public",
"int",
"sendAll",
"(",
"Iterable",
"<",
"Observable",
"<",
"Integer",
">",
">",
"batches",
",",
"final",
"int",
"numMetrics",
",",
"long",
"timeoutMillis",
")",
"{",
"final",
"AtomicBoolean",
"err",
"=",
"new",
"AtomicBoolean",
"(",
"false",
")",
... | Attempt to send all the batches totalling numMetrics in the allowed time.
@return The total number of metrics sent. | [
"Attempt",
"to",
"send",
"all",
"the",
"batches",
"totalling",
"numMetrics",
"in",
"the",
"allowed",
"time",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-atlas/src/main/java/com/netflix/servo/publish/atlas/HttpHelper.java#L149-L180 |
49,571 | Netflix/servo | servo-atlas/src/main/java/com/netflix/servo/publish/atlas/HttpHelper.java | HttpHelper.get | public Response get(HttpClientRequest<ByteBuf> req, long timeout, TimeUnit timeUnit) {
final String uri = req.getUri();
final Response result = new Response();
try {
final Func1<HttpClientResponse<ByteBuf>, Observable<byte[]>> process = response -> {
result.status = response.getStatus().code()... | java | public Response get(HttpClientRequest<ByteBuf> req, long timeout, TimeUnit timeUnit) {
final String uri = req.getUri();
final Response result = new Response();
try {
final Func1<HttpClientResponse<ByteBuf>, Observable<byte[]>> process = response -> {
result.status = response.getStatus().code()... | [
"public",
"Response",
"get",
"(",
"HttpClientRequest",
"<",
"ByteBuf",
">",
"req",
",",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"final",
"String",
"uri",
"=",
"req",
".",
"getUri",
"(",
")",
";",
"final",
"Response",
"result",
"=",
"new... | Perform an HTTP get in the allowed time. | [
"Perform",
"an",
"HTTP",
"get",
"in",
"the",
"allowed",
"time",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-atlas/src/main/java/com/netflix/servo/publish/atlas/HttpHelper.java#L185-L216 |
49,572 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/DynamicCounter.java | DynamicCounter.increment | public static void increment(String name, TagList list) {
final MonitorConfig config = new MonitorConfig.Builder(name).withTags(list).build();
increment(config);
} | java | public static void increment(String name, TagList list) {
final MonitorConfig config = new MonitorConfig.Builder(name).withTags(list).build();
increment(config);
} | [
"public",
"static",
"void",
"increment",
"(",
"String",
"name",
",",
"TagList",
"list",
")",
"{",
"final",
"MonitorConfig",
"config",
"=",
"new",
"MonitorConfig",
".",
"Builder",
"(",
"name",
")",
".",
"withTags",
"(",
"list",
")",
".",
"build",
"(",
")"... | Increment the counter for a given name, tagList. | [
"Increment",
"the",
"counter",
"for",
"a",
"given",
"name",
"tagList",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/DynamicCounter.java#L108-L111 |
49,573 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/DynamicCounter.java | DynamicCounter.increment | public static void increment(String name, TagList list, long delta) {
final MonitorConfig config = MonitorConfig.builder(name).withTags(list).build();
increment(config, delta);
} | java | public static void increment(String name, TagList list, long delta) {
final MonitorConfig config = MonitorConfig.builder(name).withTags(list).build();
increment(config, delta);
} | [
"public",
"static",
"void",
"increment",
"(",
"String",
"name",
",",
"TagList",
"list",
",",
"long",
"delta",
")",
"{",
"final",
"MonitorConfig",
"config",
"=",
"MonitorConfig",
".",
"builder",
"(",
"name",
")",
".",
"withTags",
"(",
"list",
")",
".",
"b... | Increment the counter for a given name, tagList by a given delta. | [
"Increment",
"the",
"counter",
"for",
"a",
"given",
"name",
"tagList",
"by",
"a",
"given",
"delta",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/DynamicCounter.java#L116-L119 |
49,574 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/jmx/JmxMonitorRegistry.java | JmxMonitorRegistry.getRegisteredMonitors | @Override
public Collection<Monitor<?>> getRegisteredMonitors() {
if (updatePending.getAndSet(false)) {
monitorList.set(UnmodifiableList.copyOf(monitors.values()));
}
return monitorList.get();
} | java | @Override
public Collection<Monitor<?>> getRegisteredMonitors() {
if (updatePending.getAndSet(false)) {
monitorList.set(UnmodifiableList.copyOf(monitors.values()));
}
return monitorList.get();
} | [
"@",
"Override",
"public",
"Collection",
"<",
"Monitor",
"<",
"?",
">",
">",
"getRegisteredMonitors",
"(",
")",
"{",
"if",
"(",
"updatePending",
".",
"getAndSet",
"(",
"false",
")",
")",
"{",
"monitorList",
".",
"set",
"(",
"UnmodifiableList",
".",
"copyOf... | The set of registered Monitor objects. | [
"The",
"set",
"of",
"registered",
"Monitor",
"objects",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/jmx/JmxMonitorRegistry.java#L95-L101 |
49,575 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/LongGauge.java | LongGauge.set | public void set(Long n) {
spectatorGauge.set(n);
AtomicLong number = getNumber();
number.set(n);
} | java | public void set(Long n) {
spectatorGauge.set(n);
AtomicLong number = getNumber();
number.set(n);
} | [
"public",
"void",
"set",
"(",
"Long",
"n",
")",
"{",
"spectatorGauge",
".",
"set",
"(",
"n",
")",
";",
"AtomicLong",
"number",
"=",
"getNumber",
"(",
")",
";",
"number",
".",
"set",
"(",
"n",
")",
";",
"}"
] | Set the current value. | [
"Set",
"the",
"current",
"value",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/LongGauge.java#L49-L53 |
49,576 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/BucketTimer.java | BucketTimer.getCount | public Long getCount(int pollerIndex) {
long updates = 0;
for (Counter c : bucketCount) {
updates += c.getValue(pollerIndex).longValue();
}
updates += overflowCount.getValue(pollerIndex).longValue();
return updates;
} | java | public Long getCount(int pollerIndex) {
long updates = 0;
for (Counter c : bucketCount) {
updates += c.getValue(pollerIndex).longValue();
}
updates += overflowCount.getValue(pollerIndex).longValue();
return updates;
} | [
"public",
"Long",
"getCount",
"(",
"int",
"pollerIndex",
")",
"{",
"long",
"updates",
"=",
"0",
";",
"for",
"(",
"Counter",
"c",
":",
"bucketCount",
")",
"{",
"updates",
"+=",
"c",
".",
"getValue",
"(",
"pollerIndex",
")",
".",
"longValue",
"(",
")",
... | Get the total number of updates. | [
"Get",
"the",
"total",
"number",
"of",
"updates",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/BucketTimer.java#L228-L236 |
49,577 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/publish/JmxMetricPoller.java | JmxMetricPoller.createTagList | private TagList createTagList(ObjectName name) {
Map<String, String> props = name.getKeyPropertyList();
SmallTagMap.Builder tagsBuilder = SmallTagMap.builder();
for (Map.Entry<String, String> e : props.entrySet()) {
String key = PROP_KEY_PREFIX + "." + e.getKey();
tagsBuilder.add(Tags.newTag(key... | java | private TagList createTagList(ObjectName name) {
Map<String, String> props = name.getKeyPropertyList();
SmallTagMap.Builder tagsBuilder = SmallTagMap.builder();
for (Map.Entry<String, String> e : props.entrySet()) {
String key = PROP_KEY_PREFIX + "." + e.getKey();
tagsBuilder.add(Tags.newTag(key... | [
"private",
"TagList",
"createTagList",
"(",
"ObjectName",
"name",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"props",
"=",
"name",
".",
"getKeyPropertyList",
"(",
")",
";",
"SmallTagMap",
".",
"Builder",
"tagsBuilder",
"=",
"SmallTagMap",
".",
"buil... | Creates a tag list from an object name. | [
"Creates",
"a",
"tag",
"list",
"from",
"an",
"object",
"name",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/publish/JmxMetricPoller.java#L124-L137 |
49,578 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/publish/JmxMetricPoller.java | JmxMetricPoller.addMetric | private void addMetric(
List<Metric> metrics,
String name,
TagList tags,
Object value) {
long now = System.currentTimeMillis();
if (onlyNumericMetrics) {
value = asNumber(value);
}
if (value != null) {
TagList newTags = counters.matches(MonitorConfig.builder(name).wi... | java | private void addMetric(
List<Metric> metrics,
String name,
TagList tags,
Object value) {
long now = System.currentTimeMillis();
if (onlyNumericMetrics) {
value = asNumber(value);
}
if (value != null) {
TagList newTags = counters.matches(MonitorConfig.builder(name).wi... | [
"private",
"void",
"addMetric",
"(",
"List",
"<",
"Metric",
">",
"metrics",
",",
"String",
"name",
",",
"TagList",
"tags",
",",
"Object",
"value",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"onlyNumericMet... | Create a new metric object and add it to the list. | [
"Create",
"a",
"new",
"metric",
"object",
"and",
"add",
"it",
"to",
"the",
"list",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/publish/JmxMetricPoller.java#L146-L163 |
49,579 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/publish/JmxMetricPoller.java | JmxMetricPoller.asNumber | private static Number asNumber(Object value) {
Number num = null;
if (value == null) {
num = null;
} else if (value instanceof Number) {
num = (Number) value;
} else if (value instanceof Boolean) {
num = ((Boolean) value) ? 1 : 0;
}
return num;
} | java | private static Number asNumber(Object value) {
Number num = null;
if (value == null) {
num = null;
} else if (value instanceof Number) {
num = (Number) value;
} else if (value instanceof Boolean) {
num = ((Boolean) value) ? 1 : 0;
}
return num;
} | [
"private",
"static",
"Number",
"asNumber",
"(",
"Object",
"value",
")",
"{",
"Number",
"num",
"=",
"null",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"num",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Number",
")",
"{",
... | Try to convert an object into a number. Boolean values will return 1 if
true and 0 if false. If the value is null or an unknown data type null
will be returned. | [
"Try",
"to",
"convert",
"an",
"object",
"into",
"a",
"number",
".",
"Boolean",
"values",
"will",
"return",
"1",
"if",
"true",
"and",
"0",
"if",
"false",
".",
"If",
"the",
"value",
"is",
"null",
"or",
"an",
"unknown",
"data",
"type",
"null",
"will",
"... | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/publish/JmxMetricPoller.java#L255-L265 |
49,580 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/DynamicGauge.java | DynamicGauge.set | public static void set(String name, double value) {
set(MonitorConfig.builder(name).build(), value);
} | java | public static void set(String name, double value) {
set(MonitorConfig.builder(name).build(), value);
} | [
"public",
"static",
"void",
"set",
"(",
"String",
"name",
",",
"double",
"value",
")",
"{",
"set",
"(",
"MonitorConfig",
".",
"builder",
"(",
"name",
")",
".",
"build",
"(",
")",
",",
"value",
")",
";",
"}"
] | Increment a gauge specified by a name. | [
"Increment",
"a",
"gauge",
"specified",
"by",
"a",
"name",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/DynamicGauge.java#L92-L94 |
49,581 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/DynamicGauge.java | DynamicGauge.set | public static void set(String name, TagList list, double value) {
final MonitorConfig config = MonitorConfig.builder(name).withTags(list).build();
set(config, value);
} | java | public static void set(String name, TagList list, double value) {
final MonitorConfig config = MonitorConfig.builder(name).withTags(list).build();
set(config, value);
} | [
"public",
"static",
"void",
"set",
"(",
"String",
"name",
",",
"TagList",
"list",
",",
"double",
"value",
")",
"{",
"final",
"MonitorConfig",
"config",
"=",
"MonitorConfig",
".",
"builder",
"(",
"name",
")",
".",
"withTags",
"(",
"list",
")",
".",
"build... | Set the gauge for a given name, tagList by a given value. | [
"Set",
"the",
"gauge",
"for",
"a",
"given",
"name",
"tagList",
"by",
"a",
"given",
"value",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/DynamicGauge.java#L99-L102 |
49,582 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Pollers.java | Pollers.join | private static String join(long[] a) {
assert (a.length > 0);
StringBuilder builder = new StringBuilder();
builder.append(a[0]);
for (int i = 1; i < a.length; ++i) {
builder.append(',');
builder.append(a[i]);
}
return builder.toString();
} | java | private static String join(long[] a) {
assert (a.length > 0);
StringBuilder builder = new StringBuilder();
builder.append(a[0]);
for (int i = 1; i < a.length; ++i) {
builder.append(',');
builder.append(a[i]);
}
return builder.toString();
} | [
"private",
"static",
"String",
"join",
"(",
"long",
"[",
"]",
"a",
")",
"{",
"assert",
"(",
"a",
".",
"length",
">",
"0",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"a",
"[",
"0"... | For debugging. Simple toString for non-empty arrays | [
"For",
"debugging",
".",
"Simple",
"toString",
"for",
"non",
"-",
"empty",
"arrays"
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Pollers.java#L66-L75 |
49,583 | Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Pollers.java | Pollers.parse | static long[] parse(String pollers) {
String[] periods = pollers.split(",\\s*");
long[] result = new long[periods.length];
boolean errors = false;
Logger logger = LoggerFactory.getLogger(Pollers.class);
for (int i = 0; i < periods.length; ++i) {
String period = periods[i];
try {
... | java | static long[] parse(String pollers) {
String[] periods = pollers.split(",\\s*");
long[] result = new long[periods.length];
boolean errors = false;
Logger logger = LoggerFactory.getLogger(Pollers.class);
for (int i = 0; i < periods.length; ++i) {
String period = periods[i];
try {
... | [
"static",
"long",
"[",
"]",
"parse",
"(",
"String",
"pollers",
")",
"{",
"String",
"[",
"]",
"periods",
"=",
"pollers",
".",
"split",
"(",
"\",\\\\s*\"",
")",
";",
"long",
"[",
"]",
"result",
"=",
"new",
"long",
"[",
"periods",
".",
"length",
"]",
... | Parse the content of the system property that describes the polling intervals,
and in case of errors
use the default of one poller running every minute. | [
"Parse",
"the",
"content",
"of",
"the",
"system",
"property",
"that",
"describes",
"the",
"polling",
"intervals",
"and",
"in",
"case",
"of",
"errors",
"use",
"the",
"default",
"of",
"one",
"poller",
"running",
"every",
"minute",
"."
] | d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815 | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Pollers.java#L82-L109 |
49,584 | skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/Packager.java | Packager.filterByVolumeAndWeight | private List<Container> filterByVolumeAndWeight(List<Box> boxes, List<Container> containers, int count) {
long volume = 0;
long minVolume = Long.MAX_VALUE;
long weight = 0;
long minWeight = Long.MAX_VALUE;
for (Box box : boxes) {
// volume
long boxVolume = box.getVolume();
volume += boxVolume;
... | java | private List<Container> filterByVolumeAndWeight(List<Box> boxes, List<Container> containers, int count) {
long volume = 0;
long minVolume = Long.MAX_VALUE;
long weight = 0;
long minWeight = Long.MAX_VALUE;
for (Box box : boxes) {
// volume
long boxVolume = box.getVolume();
volume += boxVolume;
... | [
"private",
"List",
"<",
"Container",
">",
"filterByVolumeAndWeight",
"(",
"List",
"<",
"Box",
">",
"boxes",
",",
"List",
"<",
"Container",
">",
"containers",
",",
"int",
"count",
")",
"{",
"long",
"volume",
"=",
"0",
";",
"long",
"minVolume",
"=",
"Long"... | Return a list of containers which can potentially hold the boxes.
@param boxes list of boxes
@param containers list of containers
@param count maximum number of possible containers
@return list of containers | [
"Return",
"a",
"list",
"of",
"containers",
"which",
"can",
"potentially",
"hold",
"the",
"boxes",
"."
] | 9609bc7515322b2de2cad0dfb3d2f72607e71aae | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/Packager.java#L325-L398 |
49,585 | skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/Box.java | Box.rotate3D | public Box rotate3D() {
int height = this.height;
this.height = width;
this.width = depth;
this.depth = height;
return this;
} | java | public Box rotate3D() {
int height = this.height;
this.height = width;
this.width = depth;
this.depth = height;
return this;
} | [
"public",
"Box",
"rotate3D",
"(",
")",
"{",
"int",
"height",
"=",
"this",
".",
"height",
";",
"this",
".",
"height",
"=",
"width",
";",
"this",
".",
"width",
"=",
"depth",
";",
"this",
".",
"depth",
"=",
"height",
";",
"return",
"this",
";",
"}"
] | Rotate box, i.e. in 3D
@return this instance | [
"Rotate",
"box",
"i",
".",
"e",
".",
"in",
"3D"
] | 9609bc7515322b2de2cad0dfb3d2f72607e71aae | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/Box.java#L27-L35 |
49,586 | skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/Box.java | Box.fitRotate2D | boolean fitRotate2D(Dimension dimension) {
if (dimension.getHeight() < height) {
return false;
}
return fitRotate2D(dimension.getWidth(), dimension.getDepth());
} | java | boolean fitRotate2D(Dimension dimension) {
if (dimension.getHeight() < height) {
return false;
}
return fitRotate2D(dimension.getWidth(), dimension.getDepth());
} | [
"boolean",
"fitRotate2D",
"(",
"Dimension",
"dimension",
")",
"{",
"if",
"(",
"dimension",
".",
"getHeight",
"(",
")",
"<",
"height",
")",
"{",
"return",
"false",
";",
"}",
"return",
"fitRotate2D",
"(",
"dimension",
".",
"getWidth",
"(",
")",
",",
"dimen... | Rotate box within a free space in 2D
@param dimension space to fit within
@return if this object fits within the input dimensions | [
"Rotate",
"box",
"within",
"a",
"free",
"space",
"in",
"2D"
] | 9609bc7515322b2de2cad0dfb3d2f72607e71aae | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/Box.java#L201-L206 |
49,587 | skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java | LargestAreaFitFirstPackager.fit2D | protected boolean fit2D(List<Box> containerProducts, Container holder, Box usedSpace, Space freeSpace, BooleanSupplier interrupt) {
if(rotate3D) {
// minimize footprint
usedSpace.fitRotate3DSmallestFootprint(freeSpace);
}
// add used space box now, but possibly rotate later - this depends on the actual re... | java | protected boolean fit2D(List<Box> containerProducts, Container holder, Box usedSpace, Space freeSpace, BooleanSupplier interrupt) {
if(rotate3D) {
// minimize footprint
usedSpace.fitRotate3DSmallestFootprint(freeSpace);
}
// add used space box now, but possibly rotate later - this depends on the actual re... | [
"protected",
"boolean",
"fit2D",
"(",
"List",
"<",
"Box",
">",
"containerProducts",
",",
"Container",
"holder",
",",
"Box",
"usedSpace",
",",
"Space",
"freeSpace",
",",
"BooleanSupplier",
"interrupt",
")",
"{",
"if",
"(",
"rotate3D",
")",
"{",
"// minimize foo... | Fit in two dimensions
@param containerProducts products to fit
@param holder target container
@param usedSpace space to subtract
@param freeSpace available space
@param interrupt interrupt
@return false if interrupted | [
"Fit",
"in",
"two",
"dimensions"
] | 9609bc7515322b2de2cad0dfb3d2f72607e71aae | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java#L185-L294 |
49,588 | skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java | LargestAreaFitFirstPackager.isBetter2D | protected int isBetter2D(Box a, Box b) {
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
return Long.compare(b.getFootprint(), a.getFootprint()); // i.e. smaller i better
} | java | protected int isBetter2D(Box a, Box b) {
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
return Long.compare(b.getFootprint(), a.getFootprint()); // i.e. smaller i better
} | [
"protected",
"int",
"isBetter2D",
"(",
"Box",
"a",
",",
"Box",
"b",
")",
"{",
"int",
"compare",
"=",
"Long",
".",
"compare",
"(",
"a",
".",
"getVolume",
"(",
")",
",",
"b",
".",
"getVolume",
"(",
")",
")",
";",
"if",
"(",
"compare",
"!=",
"0",
... | Is box b better than a?
@param a box
@param b box
@return -1 if b is better, 0 if equal, 1 if b is better | [
"Is",
"box",
"b",
"better",
"than",
"a?"
] | 9609bc7515322b2de2cad0dfb3d2f72607e71aae | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java#L432-L439 |
49,589 | skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java | LargestAreaFitFirstPackager.isBetter3D | protected int isBetter3D(Box a, Box b, Space space) {
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
// determine lowest fit
a.fitRotate3DSmallestFootprint(space);
b.fitRotate3DSmallestFootprint(space);
return Long.compare(b.getFootprint(), a.getFootprin... | java | protected int isBetter3D(Box a, Box b, Space space) {
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
// determine lowest fit
a.fitRotate3DSmallestFootprint(space);
b.fitRotate3DSmallestFootprint(space);
return Long.compare(b.getFootprint(), a.getFootprin... | [
"protected",
"int",
"isBetter3D",
"(",
"Box",
"a",
",",
"Box",
"b",
",",
"Space",
"space",
")",
"{",
"int",
"compare",
"=",
"Long",
".",
"compare",
"(",
"a",
".",
"getVolume",
"(",
")",
",",
"b",
".",
"getVolume",
"(",
")",
")",
";",
"if",
"(",
... | Is box b strictly better than a?
@param a box
@param b box
@param space free space
@return -1 if b is better, 0 if equal, 1 if b is better | [
"Is",
"box",
"b",
"strictly",
"better",
"than",
"a?"
] | 9609bc7515322b2de2cad0dfb3d2f72607e71aae | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java#L450-L460 |
49,590 | skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/impl/PermutationRotationIterator.java | PermutationRotationIterator.removePermutations | public void removePermutations(List<Integer> removed) {
int[] permutations = new int[this.permutations.length];
int index = 0;
permutations:
for (int j : this.permutations) {
for (int i = 0; i < removed.size(); i++) {
if(removed.get(i) == j) {
// skip this
removed.remove(i);
continue pe... | java | public void removePermutations(List<Integer> removed) {
int[] permutations = new int[this.permutations.length];
int index = 0;
permutations:
for (int j : this.permutations) {
for (int i = 0; i < removed.size(); i++) {
if(removed.get(i) == j) {
// skip this
removed.remove(i);
continue pe... | [
"public",
"void",
"removePermutations",
"(",
"List",
"<",
"Integer",
">",
"removed",
")",
"{",
"int",
"[",
"]",
"permutations",
"=",
"new",
"int",
"[",
"this",
".",
"permutations",
".",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"permutations",
... | Remove permutations, if present. | [
"Remove",
"permutations",
"if",
"present",
"."
] | 9609bc7515322b2de2cad0dfb3d2f72607e71aae | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/impl/PermutationRotationIterator.java#L161-L189 |
49,591 | skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/Container.java | Container.getFreeLevelSpace | public Dimension getFreeLevelSpace() {
int remainder = height - getStackHeight();
if(remainder < 0) {
throw new IllegalArgumentException("Remaining free space is negative at " + remainder + " for " + this);
}
return new Dimension(width, depth, remainder);
} | java | public Dimension getFreeLevelSpace() {
int remainder = height - getStackHeight();
if(remainder < 0) {
throw new IllegalArgumentException("Remaining free space is negative at " + remainder + " for " + this);
}
return new Dimension(width, depth, remainder);
} | [
"public",
"Dimension",
"getFreeLevelSpace",
"(",
")",
"{",
"int",
"remainder",
"=",
"height",
"-",
"getStackHeight",
"(",
")",
";",
"if",
"(",
"remainder",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Remaining free space is negative at ... | Get the free level space, i.e. container height with height of
levels subtracted.
@return free height and box dimension | [
"Get",
"the",
"free",
"level",
"space",
"i",
".",
"e",
".",
"container",
"height",
"with",
"height",
"of",
"levels",
"subtracted",
"."
] | 9609bc7515322b2de2cad0dfb3d2f72607e71aae | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/Container.java#L148-L154 |
49,592 | lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java | PnPLepetitEPnP.process | public void process( List<Point3D_F64> worldPts , List<Point2D_F64> observed , Se3_F64 solutionModel )
{
if( worldPts.size() < 4 )
throw new IllegalArgumentException("Must provide at least 4 points");
if( worldPts.size() != observed.size() )
throw new IllegalArgumentException("Must have the same number of ob... | java | public void process( List<Point3D_F64> worldPts , List<Point2D_F64> observed , Se3_F64 solutionModel )
{
if( worldPts.size() < 4 )
throw new IllegalArgumentException("Must provide at least 4 points");
if( worldPts.size() != observed.size() )
throw new IllegalArgumentException("Must have the same number of ob... | [
"public",
"void",
"process",
"(",
"List",
"<",
"Point3D_F64",
">",
"worldPts",
",",
"List",
"<",
"Point2D_F64",
">",
"observed",
",",
"Se3_F64",
"solutionModel",
")",
"{",
"if",
"(",
"worldPts",
".",
"size",
"(",
")",
"<",
"4",
")",
"throw",
"new",
"Il... | Compute camera motion given a set of features with observations and 3D locations
@param worldPts Known location of features in 3D world coordinates
@param observed Observed location of features in normalized camera coordinates
@param solutionModel Output: Storage for the found solution. | [
"Compute",
"camera",
"motion",
"given",
"a",
"set",
"of",
"features",
"with",
"observations",
"and",
"3D",
"locations"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L210-L252 |
49,593 | lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java | PnPLepetitEPnP.computeResultFromBest | private void computeResultFromBest( Se3_F64 solutionModel ) {
double bestScore = Double.MAX_VALUE;
int bestSolution=-1;
for( int i = 0; i < numControl; i++ ) {
double score = score(solutions.get(i));
if( score < bestScore ) {
bestScore = score;
bestSolution = i;
}
// System.out.println(i+" scor... | java | private void computeResultFromBest( Se3_F64 solutionModel ) {
double bestScore = Double.MAX_VALUE;
int bestSolution=-1;
for( int i = 0; i < numControl; i++ ) {
double score = score(solutions.get(i));
if( score < bestScore ) {
bestScore = score;
bestSolution = i;
}
// System.out.println(i+" scor... | [
"private",
"void",
"computeResultFromBest",
"(",
"Se3_F64",
"solutionModel",
")",
"{",
"double",
"bestScore",
"=",
"Double",
".",
"MAX_VALUE",
";",
"int",
"bestSolution",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numControl",
... | Selects the best motion hypothesis based on the actual observations and optionally
optimizes the solution. | [
"Selects",
"the",
"best",
"motion",
"hypothesis",
"based",
"on",
"the",
"actual",
"observations",
"and",
"optionally",
"optimizes",
"the",
"solution",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L258-L279 |
49,594 | lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java | PnPLepetitEPnP.score | private double score(double betas[]) {
UtilLepetitEPnP.computeCameraControl(betas,nullPts, solutionPts,numControl);
int index = 0;
double score = 0;
for( int i = 0; i < numControl; i++ ) {
Point3D_F64 si = solutionPts.get(i);
Point3D_F64 wi = controlWorldPts.get(i);
for( int j = i+1; j < numControl; ... | java | private double score(double betas[]) {
UtilLepetitEPnP.computeCameraControl(betas,nullPts, solutionPts,numControl);
int index = 0;
double score = 0;
for( int i = 0; i < numControl; i++ ) {
Point3D_F64 si = solutionPts.get(i);
Point3D_F64 wi = controlWorldPts.get(i);
for( int j = i+1; j < numControl; ... | [
"private",
"double",
"score",
"(",
"double",
"betas",
"[",
"]",
")",
"{",
"UtilLepetitEPnP",
".",
"computeCameraControl",
"(",
"betas",
",",
"nullPts",
",",
"solutionPts",
",",
"numControl",
")",
";",
"int",
"index",
"=",
"0",
";",
"double",
"score",
"=",
... | Score a solution based on distance between control points. Closer the camera
control points are from the world control points the better the score. This is
similar to how optimization score works and not the way recommended in the original
paper. | [
"Score",
"a",
"solution",
"based",
"on",
"distance",
"between",
"control",
"points",
".",
"Closer",
"the",
"camera",
"control",
"points",
"are",
"from",
"the",
"world",
"control",
"points",
"the",
"better",
"the",
"score",
".",
"This",
"is",
"similar",
"to",... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L287-L304 |
49,595 | lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java | PnPLepetitEPnP.selectWorldControlPoints | public void selectWorldControlPoints(List<Point3D_F64> worldPts, FastQueue<Point3D_F64> controlWorldPts) {
UtilPoint3D_F64.mean(worldPts,meanWorldPts);
// covariance matrix elements, summed up here for speed
double c11=0,c12=0,c13=0,c22=0,c23=0,c33=0;
final int N = worldPts.size();
for( int i = 0; i < N; i... | java | public void selectWorldControlPoints(List<Point3D_F64> worldPts, FastQueue<Point3D_F64> controlWorldPts) {
UtilPoint3D_F64.mean(worldPts,meanWorldPts);
// covariance matrix elements, summed up here for speed
double c11=0,c12=0,c13=0,c22=0,c23=0,c33=0;
final int N = worldPts.size();
for( int i = 0; i < N; i... | [
"public",
"void",
"selectWorldControlPoints",
"(",
"List",
"<",
"Point3D_F64",
">",
"worldPts",
",",
"FastQueue",
"<",
"Point3D_F64",
">",
"controlWorldPts",
")",
"{",
"UtilPoint3D_F64",
".",
"mean",
"(",
"worldPts",
",",
"meanWorldPts",
")",
";",
"// covariance m... | Selects control points along the data's axis and the data's centroid. If the data is determined
to be planar then only 3 control points are selected.
The data's axis is determined by computing the covariance matrix then performing SVD. The axis
is contained along the | [
"Selects",
"control",
"points",
"along",
"the",
"data",
"s",
"axis",
"and",
"the",
"data",
"s",
"centroid",
".",
"If",
"the",
"data",
"is",
"determined",
"to",
"be",
"planar",
"then",
"only",
"3",
"control",
"points",
"are",
"selected",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L314-L364 |
49,596 | lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java | PnPLepetitEPnP.constructM | protected static void constructM(List<Point2D_F64> obsPts,
DMatrixRMaj alphas, DMatrixRMaj M)
{
int N = obsPts.size();
M.reshape(3*alphas.numCols,2*N,false);
for( int i = 0; i < N; i++ ) {
Point2D_F64 p2 = obsPts.get(i);
int row = i*2;
for( int j = 0; j < alphas.numCols; j++ ) {
int col... | java | protected static void constructM(List<Point2D_F64> obsPts,
DMatrixRMaj alphas, DMatrixRMaj M)
{
int N = obsPts.size();
M.reshape(3*alphas.numCols,2*N,false);
for( int i = 0; i < N; i++ ) {
Point2D_F64 p2 = obsPts.get(i);
int row = i*2;
for( int j = 0; j < alphas.numCols; j++ ) {
int col... | [
"protected",
"static",
"void",
"constructM",
"(",
"List",
"<",
"Point2D_F64",
">",
"obsPts",
",",
"DMatrixRMaj",
"alphas",
",",
"DMatrixRMaj",
"M",
")",
"{",
"int",
"N",
"=",
"obsPts",
".",
"size",
"(",
")",
";",
"M",
".",
"reshape",
"(",
"3",
"*",
"... | Constructs the linear system which is to be solved.
sum a_ij*x_j - a_ij*u_i*z_j = 0
sum a_ij*y_j - a_ij*v_i*z_j = 0
where (x,y,z) is the control point to be solved for.
(u,v) is the observed normalized point | [
"Constructs",
"the",
"linear",
"system",
"which",
"is",
"to",
"be",
"solved",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L429-L452 |
49,597 | lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java | PnPLepetitEPnP.matchScale | protected double matchScale( List<Point3D_F64> nullPts ,
FastQueue<Point3D_F64> controlWorldPts ) {
Point3D_F64 meanNull = UtilPoint3D_F64.mean(nullPts,numControl,null);
Point3D_F64 meanWorld = UtilPoint3D_F64.mean(controlWorldPts.toList(),numControl,null);
// compute the ratio of distance between worl... | java | protected double matchScale( List<Point3D_F64> nullPts ,
FastQueue<Point3D_F64> controlWorldPts ) {
Point3D_F64 meanNull = UtilPoint3D_F64.mean(nullPts,numControl,null);
Point3D_F64 meanWorld = UtilPoint3D_F64.mean(controlWorldPts.toList(),numControl,null);
// compute the ratio of distance between worl... | [
"protected",
"double",
"matchScale",
"(",
"List",
"<",
"Point3D_F64",
">",
"nullPts",
",",
"FastQueue",
"<",
"Point3D_F64",
">",
"controlWorldPts",
")",
"{",
"Point3D_F64",
"meanNull",
"=",
"UtilPoint3D_F64",
".",
"mean",
"(",
"nullPts",
",",
"numControl",
",",
... | Examines the distance each point is from the centroid to determine the scaling difference
between world control points and the null points. | [
"Examines",
"the",
"distance",
"each",
"point",
"is",
"from",
"the",
"centroid",
"to",
"determine",
"the",
"scaling",
"difference",
"between",
"world",
"control",
"points",
"and",
"the",
"null",
"points",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L483-L514 |
49,598 | lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java | PnPLepetitEPnP.adjustBetaSign | private double adjustBetaSign( double beta , List<Point3D_F64> nullPts ) {
if( beta == 0 )
return 0;
int N = alphas.numRows;
int positiveCount = 0;
for( int i = 0; i < N; i++ ) {
double z = 0;
for( int j = 0; j < numControl; j++ ) {
Point3D_F64 c = nullPts.get(j);
z += alphas.get(i,j)*c.z;
... | java | private double adjustBetaSign( double beta , List<Point3D_F64> nullPts ) {
if( beta == 0 )
return 0;
int N = alphas.numRows;
int positiveCount = 0;
for( int i = 0; i < N; i++ ) {
double z = 0;
for( int j = 0; j < numControl; j++ ) {
Point3D_F64 c = nullPts.get(j);
z += alphas.get(i,j)*c.z;
... | [
"private",
"double",
"adjustBetaSign",
"(",
"double",
"beta",
",",
"List",
"<",
"Point3D_F64",
">",
"nullPts",
")",
"{",
"if",
"(",
"beta",
"==",
"0",
")",
"return",
"0",
";",
"int",
"N",
"=",
"alphas",
".",
"numRows",
";",
"int",
"positiveCount",
"=",... | Use the positive depth constraint to determine the sign of beta | [
"Use",
"the",
"positive",
"depth",
"constraint",
"to",
"determine",
"the",
"sign",
"of",
"beta"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L519-L542 |
49,599 | lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java | PnPLepetitEPnP.estimateCase1 | protected void estimateCase1( double betas[] ) {
betas[0] = matchScale(nullPts[0], controlWorldPts);
betas[0] = adjustBetaSign(betas[0],nullPts[0]);
betas[1] = 0; betas[2] = 0; betas[3] = 0;
} | java | protected void estimateCase1( double betas[] ) {
betas[0] = matchScale(nullPts[0], controlWorldPts);
betas[0] = adjustBetaSign(betas[0],nullPts[0]);
betas[1] = 0; betas[2] = 0; betas[3] = 0;
} | [
"protected",
"void",
"estimateCase1",
"(",
"double",
"betas",
"[",
"]",
")",
"{",
"betas",
"[",
"0",
"]",
"=",
"matchScale",
"(",
"nullPts",
"[",
"0",
"]",
",",
"controlWorldPts",
")",
";",
"betas",
"[",
"0",
"]",
"=",
"adjustBetaSign",
"(",
"betas",
... | Simple analytical solution. Just need to solve for the scale difference in one set
of potential control points. | [
"Simple",
"analytical",
"solution",
".",
"Just",
"need",
"to",
"solve",
"for",
"the",
"scale",
"difference",
"in",
"one",
"set",
"of",
"potential",
"control",
"points",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L574-L578 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.