Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-3830 Microprofile Metrics 2.0 #4076

Merged
merged 14 commits into from
Jul 19, 2019

Conversation

Cousjava
Copy link
Contributor

@Cousjava Cousjava commented Jul 9, 2019

@Cousjava Cousjava added this to the 5.193 milestone Jul 9, 2019
@Cousjava
Copy link
Contributor Author

Cousjava commented Jul 9, 2019

Jenkins test please

@Cousjava Cousjava force-pushed the PAYARA-3830-metrics-20 branch from 0c0e610 to 70c028d Compare July 10, 2019 09:28
@Cousjava
Copy link
Contributor Author

Jenkins test please

@Cousjava
Copy link
Contributor Author

Jenkins test please

@Cousjava
Copy link
Contributor Author

requires payara/Payara_PatchedProjects#257 to be merged first

@Cousjava
Copy link
Contributor Author

Jenkins test please

Copy link
Member

@Pandrex247 Pandrex247 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine apart from me being picky

@Cousjava
Copy link
Contributor Author

Jenkins test please

if (splitIndex == -1) {
throw new IllegalArgumentException("invalid tag: " + stringtags[i] + ", tags must be in the form key=value");
} else {
tags[i] = new Tag(stringtags[i].substring(0, splitIndex), stringtags[i].substring(splitIndex + 1));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always love small independent methods, that can be unit tested, especially when they do any index access.

For example, what it returns for tagsFromString(new String[] {"key=value", "surprise="}) ? ;)

@jGauravGupta jGauravGupta self-requested a review July 17, 2019 08:52
Changes were requested by Patrik and Gaurav
@Cousjava Cousjava force-pushed the PAYARA-3830-metrics-20 branch from b512488 to 88ddcdb Compare July 17, 2019 16:17
@Cousjava
Copy link
Contributor Author

Jenkins test please

@Cousjava Cousjava requested a review from jGauravGupta July 17, 2019 16:33
@Cousjava Cousjava requested a review from pdudits July 19, 2019 08:39
import org.eclipse.microprofile.metrics.Timer;
import org.eclipse.microprofile.metrics.annotation.Metric;

@ApplicationScoped
public class MetricsHelper {

@ConfigProperty(name="mp.metrics.tags")
String globalTags;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not required to define this property, is it?

In such case, I believe, you must inject Optional<String> to prevent injection failures.

@@ -67,34 +69,95 @@

@Produces
private Counter counter(InjectionPoint ip) {
return registry.counter(helper.metadataOf(ip, Counter.class));
Metric annotation = ip.getAnnotated().getAnnotation(Metric.class);
if (annotation != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see some method to be extracted here. This block could be extracted and reused in downward methods, but it's type definition would be horrendous (T register(BiFunction<Metadata,Tag[],T> factory1,BiFunction<String,Tag[]> factory2, .Function<String,T> factory3)... actually I was expecting to type much more).
You could at least extract the condition, and the construction of default name into their own methods

@Cousjava Cousjava force-pushed the PAYARA-3830-metrics-20 branch from fbf02b5 to 91d7d20 Compare July 19, 2019 12:46
@Cousjava
Copy link
Contributor Author

Jenkins test please

@Cousjava Cousjava merged commit df8ebd0 into payara:master Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants