You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@aurora.apache.org by "Joe Smith (JIRA)" <ji...@apache.org> on 2015/07/28 06:36:04 UTC
[jira] [Commented] (AURORA-1282) twitter.common.stats.Stats warns
about exported metric names
[ https://issues.apache.org/jira/browse/AURORA-1282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14643833#comment-14643833 ]
Joe Smith commented on AURORA-1282:
-----------------------------------
So in vagrant, running as-is, we get slashes:
{noformat}
sla_vagrant/test/labrat_job_uptime_50.00_sec 18
sla_vagrant/test/labrat_job_uptime_75.00_sec 18
sla_vagrant/test/labrat_job_uptime_90.00_sec 18
sla_vagrant/test/labrat_job_uptime_95.00_sec 18
sla_vagrant/test/labrat_job_uptime_99.00_sec 18
sla_vagrant/test/labrat_mtta_ms 51
sla_vagrant/test/labrat_mttr_ms 1098
sla_vagrant/test/labrat_platform_uptime_percent 100.0
{noformat}
Going into Commons with a small test:
{noformat}
[tw-mbp-jsmith commons (master)]$ git diff
diff --git a/tests/java/com/twitter/common/stats/StatsTest.java b/tests/java/com/twitter/common/stats/StatsTest.java
index 4cf7bab..1b70b53 100644
--- a/tests/java/com/twitter/common/stats/StatsTest.java
+++ b/tests/java/com/twitter/common/stats/StatsTest.java
@@ -21,6 +21,7 @@ import org.junit.Test;
import java.util.concurrent.atomic.AtomicLong;
+import com.google.common.base.Supplier;
import com.google.common.util.concurrent.AtomicDouble;
import static org.hamcrest.CoreMatchers.is;
@@ -101,6 +102,21 @@ public class StatsTest {
assertCounter("d_f", 1);
}
+ @Test
+ public void testNormalizesStatsProviderIllegalChars() {
+ class Counter implements Supplier<Number> {
+ @Override
+ public Number get() {
+ return 9001L;
+ }
+ }
+
+ StatsProvider statsProvider = Stats.STATS_PROVIDER;
+ statsProvider.makeGauge("devcluster/aurora/test/jobName", new Counter());
+ assertCounter("devcluster_aurora_test_jobName", 9001);
+ //assertCounter("devcluster/aurora/test/jobName", 9001);
+ }
+
private void assertCounter(String name, long value) {
assertThat(Stats.<Long>getVariable(name).read(), is(value));
}
{noformat}
We see that the slashes are indeed taken out:
{{OK (88 tests)}}
And when we swap out the commented line, we indeed see there is no stat with the kooky, slash-ified name:
{noformat}
[tw-mbp-jsmith commons (master)]$ ./pants test ./tests/java/com/twitter/common/stats
INFO] Detected git repository at /Users/jsmith/Documents/commons on branch master
21:32:15 00:00 [main]
(To run a reporting server: ./pants server)
21:32:15 00:00 [bootstrap]
21:32:15 00:00 [setup]
21:32:15 00:00 [parse]
Executing tasks in goals: bootstrap -> imports -> unpack-jars -> deferred-sources -> gen -> resolve -> compile -> resources -> test
21:32:15 00:00 [bootstrap]
21:32:15 00:00 [bootstrap-jvm-tools]
21:32:15 00:00 [imports]
21:32:15 00:00 [ivy-imports]
21:32:15 00:00 [unpack-jars]
21:32:15 00:00 [unpack-jars]
21:32:15 00:00 [deferred-sources]
21:32:15 00:00 [deferred-sources]
21:32:15 00:00 [gen]
21:32:15 00:00 [thrift]
21:32:15 00:00 [protoc]
21:32:15 00:00 [execute]
21:32:15 00:00 [antlr]
21:32:15 00:00 [execute]
21:32:15 00:00 [ragel]
21:32:15 00:00 [jaxb]
21:32:15 00:00 [execute]
21:32:15 00:00 [wire]
21:32:15 00:00 [execute]
21:32:15 00:00 [scrooge]
21:32:15 00:00 [resolve]
21:32:15 00:00 [ivy]
21:32:16 00:01 [compile]
21:32:16 00:01 [compile]
21:32:16 00:01 [jvm]
21:32:16 00:01 [jvm-compilers]
21:32:16 00:01 [find-deleted-sources]
21:32:16 00:01 [prepare-analysis]
Invalidated 1 target.
21:32:16 00:01 [partition-analysis]
Compiling 18 java sources in 1 target (partition 1 of 1).
21:32:16 00:01 [compile]
21:32:16 00:01 [jmake]
Jmake version 1.3.8-10
Opening project database... Done.
Recompiling source files:
/Users/jsmith/Documents/commons/tests/java/com/twitter/common/stats/StatsTest.java
Reading existing dependency file at /Users/jsmith/Documents/commons/.pants.d/compile/jvm/java/jmake-depfiles/global_depfile
Writing class dependency file to /Users/jsmith/Documents/commons/.pants.d/compile/jvm/java/jmake-depfiles/global_depfile
Checking com/twitter/common/stats/StatsTest
Writing project database... Done.
21:32:16 00:01 [update-upstream-analysis]
21:32:16 00:01 [find-missing-dependencies]
21:32:16 00:01 [map_sources]
21:32:16 00:01 [map_classes]
21:32:16 00:01 [map_jars]
21:32:16 00:01 [scan_deps]
21:32:16 00:01 [trim-downstream-analysis]
21:32:16 00:01 [checkstyle]
Invalidated 1 target.
21:32:16 00:01 [checkstyle]
21:32:16 00:01 [scalastyle]
21:32:16 00:01 [python-eval]
21:32:16 00:01 [eval-targets]
21:32:17 00:02 [resources]
21:32:17 00:02 [prepare]
21:32:17 00:02 [services]
21:32:17 00:02 [args-apt]
21:32:17 00:02 [test]
21:32:17 00:02 [run_prep_command]
21:32:17 00:02 [test]
21:32:17 00:02 [pytest]
21:32:17 00:02 [junit]
21:32:17 00:02 [run]
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
Auto-detected 8 processors, using -parallel-threads=8
.........E...............................................................................
Time: 0.713
There was 1 failure:
1) testNormalizesStatsProviderIllegalChars(com.twitter.common.stats.StatsTest)
java.lang.NullPointerException
at com.twitter.common.stats.StatsTest.assertCounter(StatsTest.java:121)
at com.twitter.common.stats.StatsTest.testNormalizesStatsProviderIllegalChars(StatsTest.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at __shaded_by_pants__.org.pantsbuild.tools.junit.withretry.BlockJUnit4ClassRunnerWithRetry$InvokeWithRetry.evaluate(BlockJUnit4ClassRunnerWithRetry.java:57)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at __shaded_by_pants__.org.pantsbuild.tools.junit.impl.CompositeRequest.runChild(CompositeRequest.java:66)
at __shaded_by_pants__.org.pantsbuild.tools.junit.impl.ConcurrentCompositeRequest$1$1.run(ConcurrentCompositeRequest.java:36)
at __shaded_by_pants__.org.pantsbuild.tools.junit.impl.ConcurrentRunnerScheduler.finished(ConcurrentRunnerScheduler.java:85)
at __shaded_by_pants__.org.pantsbuild.tools.junit.impl.ConcurrentCompositeRequest$1.evaluate(ConcurrentCompositeRequest.java:45)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at __shaded_by_pants__.org.pantsbuild.tools.junit.impl.ConsoleRunnerImpl.run(ConsoleRunnerImpl.java:334)
at __shaded_by_pants__.org.pantsbuild.tools.junit.impl.ConsoleRunnerImpl.main(ConsoleRunnerImpl.java:660)
at org.pantsbuild.tools.junit.ConsoleRunner.main(ConsoleRunner.java:12)
FAILURES!!!
Tests run: 88, Failures: 1
FAILURE: java org.pantsbuild.tools.junit.ConsoleRunner ... exited non-zero (1); 0 failed targets.
Waiting for background workers to finish.
21:32:18 00:03 [complete]
FAILURE
{noformat}
Next thing to confirm is if we were to throw in an {{normalizeName}}, as seen [in the reviewboard I sent out a bit ago|https://reviews.apache.org/r/34020/diff/1#index_header], if it would change the stat name to no longer have the slashes.
If we want, we could just make slashes a possibility in Twitter Common Stats, but the 'magic' I'm still seeing is pretty unsettling.
> twitter.common.stats.Stats warns about exported metric names
> ------------------------------------------------------------
>
> Key: AURORA-1282
> URL: https://issues.apache.org/jira/browse/AURORA-1282
> Project: Aurora
> Issue Type: Bug
> Reporter: Stephan Erb
> Assignee: Joe Smith
> Priority: Minor
>
> The Aurora log file gets spammed with lots of warnings for each service/job:
> {code}
> W0417 11:10:06.046 THREAD159 com.twitter.common.stats.Stats.validateName: Invalid stat name sla_testcluster/test/myservice_mttr_nonprod_ms exported as sla_testcluster_test_myservice_mttr_nonprod_ms
> {code}
> Any proposals how we might get rid of them or silence them?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)