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

Add support for superTypeRestriction in instrumentation config JSON #207

Merged
merged 1 commit into from
May 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public String subTypeRestriction() {
return "";
}

@Value.Default
@JsonInclude(value = Include.NON_EMPTY)
public String superTypeRestriction() {
return "";
}

// pointcuts with methodDeclaringClassName are no longer supported in 0.9.16, but included here
// to help with transitioning of old instrumentation config
@Deprecated
Expand Down Expand Up @@ -237,6 +243,7 @@ public AgentConfig.InstrumentationConfig toProto() {
.setClassName(className())
.setClassAnnotation(classAnnotation())
.setSubTypeRestriction(subTypeRestriction())
.setSuperTypeRestriction(superTypeRestriction())
// pointcuts with methodDeclaringClassName are no longer supported in
// 0.9.16, but included here to help with transitioning of old
// instrumentation config
Expand Down Expand Up @@ -277,6 +284,7 @@ public static InstrumentationConfig create(AgentConfig.InstrumentationConfig con
.className(config.getClassName())
.classAnnotation(config.getClassAnnotation())
.subTypeRestriction(config.getSubTypeRestriction())
.superTypeRestriction(config.getSuperTypeRestriction())
// pointcuts with methodDeclaringClassName are no longer supported in 0.9.16, but
// included here to help with transitioning of old instrumentation config
.methodDeclaringClassName(config.getMethodDeclaringClassName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public ClassLoader run() {
builder.pointcutClassNamePattern(buildPattern(pointcut.className()));
builder.pointcutClassAnnotationPattern(buildPattern(pointcut.classAnnotation()));
builder.pointcutSubTypeRestrictionPattern(buildPattern(pointcut.subTypeRestriction()));
builder.pointcutSuperTypeRestrictionPattern(buildPattern(pointcut.superTypeRestriction()));
builder.pointcutMethodNamePattern(buildPattern(pointcut.methodName()));
builder.pointcutMethodAnnotationPattern(buildPattern(pointcut.methodAnnotation()));
builder.pointcutMethodParameterTypes(buildPatterns(pointcut.methodParameterTypes()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ private void addClassAnnotation(ClassWriter cw) {
annotationVisitor.visit("className", config.className());
annotationVisitor.visit("classAnnotation", config.classAnnotation());
annotationVisitor.visit("subTypeRestriction", config.subTypeRestriction());
annotationVisitor.visit("superTypeRestriction", config.superTypeRestriction());
annotationVisitor.visit("methodName", config.methodName());
annotationVisitor.visit("methodAnnotation", config.methodAnnotation());
AnnotationVisitor arrayAnnotationVisitor =
Expand Down
1 change: 1 addition & 0 deletions ui/app/scripts/controllers/config/instrumentation-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ glowroot.controller('ConfigInstrumentationListCtrl', [
var base = {
classAnnotation: '',
subTypeRestriction: '',
superTypeRestriction: '',
methodAnnotation: '',
methodReturnType: '',
nestingGroup: '',
Expand Down
1 change: 1 addition & 0 deletions ui/app/scripts/controllers/config/instrumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ glowroot.controller('ConfigInstrumentationCtrl', [
// (see instrumentation-list.js)
classAnnotation: '',
subTypeRestriction: '',
superTypeRestriction: '',
methodAnnotation: '',
nestingGroup: '',
order: 0,
Expand Down
3 changes: 3 additions & 0 deletions ui/app/scripts/services/instrumentation-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ glowroot.factory('instrumentationExport', [
if (!config.subTypeRestriction) {
delete config.subTypeRestriction;
}
if (!config.superTypeRestriction) {
delete config.superTypeRestriction;
}
if (!config.methodAnnotation) {
delete config.methodAnnotation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ abstract static class InstrumentationConfigDto {
abstract String className();
abstract String classAnnotation();
abstract String subTypeRestriction();
abstract String superTypeRestriction();
// pointcuts with methodDeclaringClassName are no longer supported in 0.9.16, but
// included here to help with transitioning of old instrumentation config
//
Expand Down Expand Up @@ -358,6 +359,7 @@ private InstrumentationConfig convert() {
.setClassName(className())
.setClassAnnotation(classAnnotation())
.setSubTypeRestriction(subTypeRestriction())
.setSuperTypeRestriction(superTypeRestriction())
// pointcuts with methodDeclaringClassName are no longer supported in 0.9.16,
// but included here to help with transitioning of old instrumentation config
//
Expand Down Expand Up @@ -402,6 +404,7 @@ private static InstrumentationConfigDto create(InstrumentationConfig config) {
.className(config.getClassName())
.classAnnotation(config.getClassAnnotation())
.subTypeRestriction(config.getSubTypeRestriction())
.superTypeRestriction(config.getSuperTypeRestriction())
// pointcuts with methodDeclaringClassName are no longer supported in
// 0.9.16, but included here to help with transitioning of old
// instrumentation config
Expand Down
1 change: 1 addition & 0 deletions wire-api/src/main/proto/AgentConfig.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ message AgentConfig {
string class_name = 1;
string class_annotation = 2;
string sub_type_restriction = 24;
string super_type_restriction = 25;
string method_declaring_class_name = 3; // deprecated in 0.9.16, still supported here for
// glowroot central 0.9.16 or newer running agent 0.9.15
// or older
Expand Down