Skip to content

Commit a337025

Browse files
authored
Merge pull request #79 from intergral/build
fix(example): fix compile issue in example
2 parents f013f3c + c1732ff commit a337025

File tree

4 files changed

+44
-16
lines changed

4 files changed

+44
-16
lines changed

.github/workflows/on_push.yml

+17
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
java-version: '11'
4747
distribution: 'temurin'
4848
cache: 'maven'
49+
4950
- name: Check Formatting
5051
run: make lint
5152

@@ -60,6 +61,7 @@ jobs:
6061
java-version: '11'
6162
distribution: 'temurin'
6263
cache: 'maven'
64+
6365
- name: Run PMD check
6466
run: make pmd
6567

@@ -75,6 +77,21 @@ jobs:
7577
java-version: '11'
7678
distribution: 'temurin'
7779
cache: 'maven'
80+
7881
- name: Run docs check
7982
run: make docs
8083

84+
compile:
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/checkout@v3
88+
89+
- name: Set up JDK 11
90+
uses: actions/setup-java@v3
91+
with:
92+
java-version: '11'
93+
distribution: 'temurin'
94+
cache: 'maven'
95+
96+
- name: Run compile check
97+
run: make compile

Makefile

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,61 @@
1+
# This file just contains shortcuts for dev, as there are a lot of options for different builds
12

2-
3+
# Run the PMD check - while skipping tests
4+
# Doesn't run PMD on it tests or examples
35
.PHONY: pmd
46
pmd:
57
mvn -U -B verify -Ppmd -DskipTests $(MVN_ARGS)
68

9+
# Run lint on all code
710
,PHONY: lint
811
lint:
912
mvn -U -B validate -Plint,examples,cf-it-tests $(MVN_ARGS)
1013

14+
# Package and verify all code expect cf-tests and examples
1115
.PHONY: test
1216
test:
1317
mvn -U -B clean verify $(MVN_ARGS)
1418

19+
# Generate documentation from source
1520
.PHONY: docs
1621
docs:
1722
mvn -s .ci-settings.xml clean package javadoc:jar -DskipTests -P release-ossrh -B -U -pl agent,deep --also-make $(MVN_ARGS)
1823

24+
# Generate the agent and rebuild all the dependant modules
1925
.PHONY: package-agent
2026
package:
2127
mvn package -U -B -pl agent --also-make -DskipTests $(MVN_ARGS)
2228

29+
# Run the CF it tests
2330
.PHONY: cf-tests
2431
cf-tests: package
2532
mvn verify -U -B -P cf-it-tests -pl it-tests/cf-tests --also-make $(MVN_ARGS)
26-
# This file just contains shortcuts for dev, as there are a lot of options for different builds
2733

34+
# Build the agent and deep, also rebuild all dependant modules
2835
.PHONY: build
2936
build:
3037
mvn clean package -U -B -pl agent,deep --also-make $(MVN_ARGS)
3138

32-
39+
# Install the agent and deep into the local repo (~/.m2)
3340
.PHONY: install
3441
install:
3542
mvn clean install -U -B -pl agent,deep --also-make $(MVN_ARGS)
3643

44+
# Run the coverage checks
3745
.PHONY: coverage
3846
coverage:
3947
mvn clean verify -U -B -P coverage -pl '!it-tests/java-tests,!it-tests'
4048

49+
# Compile all modules
50+
.PHONY: compile
51+
compile:
52+
mvn clean compile -U -B -P cf-it-tests,coverage,docs,examples,lint,pmd
53+
54+
# Combine a few common checks in a single task
4155
.PHONY: precommit
4256
precommit:
4357
$(MAKE) lint
4458
$(MAKE) pmd
4559
$(MAKE) coverage
46-
$(MAKE) docs
60+
$(MAKE) docs
61+
$(MAKE) compile

deep/pom.xml

+3-10
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@
8383
<artifactId>maven-dependency-plugin</artifactId>
8484
<executions>
8585
<execution>
86-
<!-- Unpack tcnative so we can relocate these -->
87-
<id>unpack-tcnative</id>
88-
<phase>generate-resources</phase>
86+
<!-- Unpack dependant jars -->
87+
<id>unpack</id>
88+
<phase>prepare-package</phase>
8989
<goals>
9090
<goal>copy</goal>
9191
</goals>
@@ -98,13 +98,6 @@
9898
<outputDirectory>${project.build.directory}/unpack/</outputDirectory>
9999
<destFileName>deep-agent.jar</destFileName>
100100
</dependency>
101-
<!-- <dependency>-->
102-
<!-- <groupId>com.nerdvision</groupId>-->
103-
<!-- <artifactId>native</artifactId>-->
104-
<!-- <version>${project.version}</version>-->
105-
<!-- <outputDirectory>${project.build.directory}/unpack/</outputDirectory>-->
106-
<!-- <destFileName>nerdvision-native.jar</destFileName>-->
107-
<!-- </dependency>-->
108101
<dependency>
109102
<groupId>com.sun</groupId>
110103
<artifactId>tools</artifactId>

examples/prometheus-metrics-example/src/main/java/com/intergral/deep/examples/Main.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.intergral.deep.Deep;
2222
import com.intergral.deep.agent.api.IDeep;
2323
import com.intergral.deep.agent.api.plugin.MetricDefinition;
24+
import com.intergral.deep.agent.api.plugin.MetricDefinition.Label;
2425
import com.intergral.deep.agent.api.reflection.IReflection;
2526
import com.intergral.deep.agent.api.settings.ISettings;
2627
import com.intergral.deep.api.DeepAPI;
@@ -29,8 +30,10 @@
2930
import io.prometheus.metrics.model.snapshots.Unit;
3031
import java.nio.file.Path;
3132
import java.nio.file.Paths;
33+
import java.util.ArrayList;
3234
import java.util.Collections;
3335
import java.util.HashMap;
36+
import java.util.List;
3437
import java.util.Map;
3538
import java.util.Random;
3639

@@ -90,7 +93,7 @@ public static void main(String[] args) throws Throwable {
9093

9194
System.out.println("HTTPServer listening on port http://localhost:" + server.getPort() + "/metrics");
9295

93-
final HashMap<String, String> tags = new HashMap<>();
96+
final List<Label> labels = new ArrayList<>();
9497
// USe the API to create a tracepoint that will fire forever
9598
final Map<String, String> fireCount = new HashMap<>();
9699
fireCount.put("fire_count", "-1");
@@ -100,7 +103,7 @@ public static void main(String[] args) throws Throwable {
100103
.registerTracepoint("com/intergral/deep/examples/SimpleTest", 46,
101104
fireCount, Collections.emptyList(),
102105
Collections.singletonList(
103-
new MetricDefinition("custom_metric", tags, "histogram", "this.cnt", "deep", "help message", "unit")));
106+
new MetricDefinition("custom_metric", labels, "histogram", "this.cnt", "deep", "help message", "unit")));
104107

105108
Random random = new Random(0);
106109
final SimpleTest ts = new SimpleTest("This is a test", 2);

0 commit comments

Comments
 (0)