Skip to content

Commit 48efe15

Browse files
niloc132zbynek
andauthored
Include GWT version, commit in JFR output (#10312)
Enhances the "manual, opt-in analytics" by allowing users to upload JFR dumps of a build and detect which particular version or build resulted in the dump. Deliberately omits command line args at this time - users can leave the default JVM events in place so these are detected or specify them manually. An automatic approach would need more code, able to remove details like paths and module names from the output. Fixes #10269 Co-authored-by: Zbynek Konecny <zbynek1729@gmail.com>
1 parent 3caf879 commit 48efe15

8 files changed

Lines changed: 66 additions & 3 deletions

File tree

dev/codeserver/java/com/google/gwt/dev/codeserver/CodeServer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.google.gwt.dev.javac.UnitCacheSingleton;
2525
import com.google.gwt.dev.util.DiskCachingUtil;
2626
import com.google.gwt.dev.util.log.PrintWriterTreeLogger;
27+
import com.google.gwt.dev.util.log.perf.GwtStartupEvent;
2728
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap;
2829

2930
import java.io.File;
@@ -51,6 +52,7 @@ public static void main(String[] args) throws Exception {
5152
if (!options.parseArgs(args)) {
5253
System.exit(1);
5354
}
55+
new GwtStartupEvent(CodeServer.class);
5456

5557
main(options);
5658
}

dev/core/src/com/google/gwt/dev/About.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
public class About {
2626
/**
27-
* Tag used for text replacement of the SVN version (split up to avoid
27+
* Tag used for text replacement of the Git version (split up to avoid
2828
* replacing it here).
2929
*/
3030
private static final String GWT_GITREV_TAG = "@GWT_" + "GITREV@";
@@ -35,7 +35,7 @@ public class About {
3535
*/
3636
private static final String GWT_VERSION_TAG = "@GWT_" + "VERSION@";
3737

38-
private static final String gwtName = "Google Web Toolkit";
38+
private static final String gwtName = "GWT Web Toolkit";
3939
private static final String gwtGitRev;
4040
private static final GwtVersion gwtVersion;
4141

dev/core/src/com/google/gwt/dev/CompilePermsServer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.google.gwt.dev.util.arg.ArgHandlerLogLevel;
2727
import com.google.gwt.dev.util.arg.OptionLogLevel;
2828
import com.google.gwt.dev.util.log.PrintWriterTreeLogger;
29+
import com.google.gwt.dev.util.log.perf.GwtStartupEvent;
2930
import com.google.gwt.util.tools.ArgHandlerString;
3031

3132
import java.io.File;
@@ -234,6 +235,7 @@ public static void main(String[] args) {
234235
int exitCode = -1;
235236
final CompileServerOptions options = new CompileServerOptionsImpl();
236237
if (new ArgProcessor(options).processArgs(args)) {
238+
new GwtStartupEvent(CompilePermsServer.class);
237239
PrintWriterTreeLogger logger = new PrintWriterTreeLogger();
238240
logger.setMaxDetail(options.getLogLevel());
239241
if (run(options, logger)) {

dev/core/src/com/google/gwt/dev/Compiler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import com.google.gwt.dev.util.arg.ArgHandlerWarDir;
3636
import com.google.gwt.dev.util.arg.ArgHandlerWorkDirOptional;
3737
import com.google.gwt.dev.util.arg.OptionOptimize;
38+
import com.google.gwt.dev.util.log.perf.GwtStartupEvent;
3839
import com.google.gwt.dev.util.log.perf.SimpleEvent;
3940
import com.google.gwt.thirdparty.guava.common.collect.Sets;
4041
import com.google.gwt.thirdparty.guava.common.io.MoreFiles;
@@ -101,6 +102,7 @@ public static void main(String[] args) {
101102
*/
102103
final CompilerOptions options = new CompilerOptionsImpl();
103104
if (new ArgProcessor(options).processArgs(args)) {
105+
new GwtStartupEvent(Compiler.class);
104106
CompileTask task = new CompileTask() {
105107
@Override
106108
public boolean run(TreeLogger logger) throws UnableToCompleteException {

dev/core/src/com/google/gwt/dev/DevMode.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import com.google.gwt.dev.util.arg.ArgHandlerWarDir;
4747
import com.google.gwt.dev.util.arg.ArgHandlerWorkDirOptional;
4848
import com.google.gwt.dev.util.arg.OptionModulePathPrefix;
49+
import com.google.gwt.dev.util.log.perf.GwtStartupEvent;
4950
import com.google.gwt.dev.util.log.perf.SimpleEvent;
5051
import com.google.gwt.thirdparty.guava.common.io.MoreFiles;
5152
import com.google.gwt.thirdparty.guava.common.io.RecursiveDeleteOption;
@@ -473,6 +474,7 @@ public static void main(String[] args) {
473474
*/
474475
DevMode hostedMode = new DevMode();
475476
if (new ArgProcessor(hostedMode.options).processArgs(args)) {
477+
new GwtStartupEvent(DevMode.class);
476478
hostedMode.run();
477479
// Exit w/ success code.
478480
System.exit(0);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2026 GWT Project Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
package com.google.gwt.dev.util.log.perf;
17+
18+
import com.google.gwt.dev.About;
19+
20+
import jdk.jfr.Category;
21+
import jdk.jfr.Description;
22+
import jdk.jfr.Event;
23+
import jdk.jfr.Name;
24+
import jdk.jfr.StackTrace;
25+
26+
/**
27+
* Logs the class that was used to run GWT and the GWT build in use.
28+
*/
29+
@Name("gwt.Startup")
30+
@Description("Basic startup info about the current GWT process")
31+
@Category("GWT")
32+
@StackTrace(false)
33+
public class GwtStartupEvent extends Event {
34+
@Description("GWT compiler version")
35+
final String gwtVersion = About.getGwtVersion();
36+
37+
@Description("Git revision of the GWT compiler build")
38+
final String gwtCommit = About.getGwtGitRev();
39+
40+
@Description("Class being invoked to start the compiler")
41+
final Class<?> main;
42+
43+
public GwtStartupEvent(Class<?> main) {
44+
this.main = main;
45+
commit();
46+
}
47+
}

dev/core/test/com/google/gwt/dev/AboutTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@ public class AboutTest extends TestCase {
2424

2525
public void testGwtName() {
2626
String result = About.getGwtName();
27-
assertTrue("Google Web Toolkit".equals(result));
27+
assertTrue("GWT Web Toolkit".equals(result));
2828
}
2929

3030
public void testGwtSvnRev() {
3131
String result = About.getGwtSvnRev();
3232
assertFalse(result.length() == 0);
3333
}
3434

35+
public void testGwtGitRev() {
36+
String result = About.getGwtGitRev();
37+
assertFalse(result.length() == 0);
38+
}
39+
3540
public void testGwtVersion() {
3641
String result = About.getGwtVersion();
3742
assertFalse(result.length() == 0);

user/src/com/google/gwt/junit/JUnitShell.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import com.google.gwt.dev.util.arg.ArgHandlerStrict;
6464
import com.google.gwt.dev.util.arg.ArgHandlerWarDir;
6565
import com.google.gwt.dev.util.arg.ArgHandlerWorkDirOptional;
66+
import com.google.gwt.dev.util.log.perf.GwtStartupEvent;
6667
import com.google.gwt.junit.JUnitMessageQueue.ClientStatus;
6768
import com.google.gwt.junit.client.GWTTestCase;
6869
import com.google.gwt.junit.client.TimeoutException;
@@ -694,6 +695,8 @@ static JUnitShell getUnitTestShell() {
694695
if (!argProcessor.processArgs(args)) {
695696
throw new JUnitFatalLaunchException("Error processing shell arguments");
696697
}
698+
new GwtStartupEvent(JUnitShell.class);
699+
697700
// Always bind to the wildcard address and substitute the host address in
698701
// URLs. Note that connectAddress isn't actually used here, as we
699702
// override it from the runsStyle in getModuleUrl, but we set it to match

0 commit comments

Comments
 (0)