Skip to content

Commit 0f57d39

Browse files
committed
rename things to make linter happy
1 parent b61acff commit 0f57d39

File tree

2 files changed

+29
-28
lines changed
  • instrumentation
    • opentelemetry-extension-annotations-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extensionannotations
    • opentelemetry-instrumentation-annotations-1.16/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/instrumentationannotations

2 files changed

+29
-28
lines changed

instrumentation/opentelemetry-extension-annotations-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/extensionannotations/WithSpanInstrumentation.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,26 +120,26 @@ static ElementMatcher.Junction<MethodDescription> configureExcludedMethods() {
120120
@SuppressWarnings("unused")
121121
public static class WithSpanAdvice {
122122

123-
public static class AdviceScope {
123+
public static class WithSpanAdviceScope {
124124
private final Method method;
125125
private final Context context;
126126
private final Scope scope;
127127

128-
private AdviceScope(Method method, Context context, Scope scope) {
128+
private WithSpanAdviceScope(Method method, Context context, Scope scope) {
129129
this.method = method;
130130
this.context = context;
131131
this.scope = scope;
132132
}
133133

134134
@Nullable
135-
public static AdviceScope start(Method method) {
135+
public static WithSpanAdviceScope start(Method method) {
136136
Instrumenter<Method, Object> instrumenter = WithSpanSingletons.instrumenter();
137137
Context current = Context.current();
138138
if (!instrumenter.shouldStart(current, method)) {
139139
return null;
140140
}
141141
Context context = instrumenter.start(current, method);
142-
return new AdviceScope(method, context, context.makeCurrent());
142+
return new WithSpanAdviceScope(method, context, context.makeCurrent());
143143
}
144144

145145
public Object end(Object returnValue, @Nullable Throwable throwable) {
@@ -153,18 +153,18 @@ public Object end(Object returnValue, @Nullable Throwable throwable) {
153153

154154
@Nullable
155155
@Advice.OnMethodEnter(suppress = Throwable.class)
156-
public static AdviceScope onEnter(@Advice.Origin Method originMethod) {
156+
public static WithSpanAdviceScope onEnter(@Advice.Origin Method originMethod) {
157157
// Every usage of @Advice.Origin Method is replaced with a call to Class.getMethod, copy it
158158
// to local variable so that there would be only one call to Class.getMethod.
159-
return AdviceScope.start(originMethod);
159+
return WithSpanAdviceScope.start(originMethod);
160160
}
161161

162162
@AssignReturned.ToReturned
163163
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
164164
public static Object stopSpan(
165165
@Advice.Return(typing = Assigner.Typing.DYNAMIC) Object returnValue,
166166
@Advice.Thrown @Nullable Throwable throwable,
167-
@Advice.Enter @Nullable AdviceScope adviceScope) {
167+
@Advice.Enter @Nullable WithSpanAdviceScope adviceScope) {
168168
if (adviceScope != null) {
169169
return adviceScope.end(returnValue, throwable);
170170
}
@@ -175,29 +175,29 @@ public static Object stopSpan(
175175
@SuppressWarnings("unused")
176176
public static class WithSpanAttributesAdvice {
177177

178-
public static class AdviceScope {
178+
public static class WithSpanAttributesAdviceScope {
179179
private final Method method;
180180
private final MethodRequest request;
181181
private final Context context;
182182
private final Scope scope;
183183

184-
private AdviceScope(Method method, MethodRequest request, Context context, Scope scope) {
184+
private WithSpanAttributesAdviceScope(Method method, MethodRequest request, Context context, Scope scope) {
185185
this.method = method;
186186
this.request = request;
187187
this.context = context;
188188
this.scope = scope;
189189
}
190190

191191
@Nullable
192-
public static AdviceScope start(Method method, MethodRequest request) {
192+
public static WithSpanAttributesAdviceScope start(Method method, MethodRequest request) {
193193
Instrumenter<MethodRequest, Object> instrumenter =
194194
WithSpanSingletons.instrumenterWithAttributes();
195195
Context current = Context.current();
196196
if (!instrumenter.shouldStart(current, request)) {
197197
return null;
198198
}
199199
Context context = instrumenter.start(current, request);
200-
return new AdviceScope(method, request, context, context.makeCurrent());
200+
return new WithSpanAttributesAdviceScope(method, request, context, context.makeCurrent());
201201
}
202202

203203
public Object end(@Nullable Object returnValue, @Nullable Throwable throwable) {
@@ -212,21 +212,21 @@ public Object end(@Nullable Object returnValue, @Nullable Throwable throwable) {
212212
}
213213

214214
@Advice.OnMethodEnter(suppress = Throwable.class)
215-
public static AdviceScope onEnter(
215+
public static WithSpanAttributesAdviceScope onEnter(
216216
@Advice.Origin Method originMethod,
217217
@Advice.AllArguments(typing = Assigner.Typing.DYNAMIC) Object[] args) {
218218
// Every usage of @Advice.Origin Method is replaced with a call to Class.getMethod, copy it
219219
// to local variable so that there would be only one call to Class.getMethod.
220220
MethodRequest request = new MethodRequest(originMethod, args);
221-
return AdviceScope.start(originMethod, request);
221+
return WithSpanAttributesAdviceScope.start(originMethod, request);
222222
}
223223

224224
@AssignReturned.ToReturned
225225
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
226226
public static Object stopSpan(
227227
@Advice.Return @Nullable Object returnValue,
228228
@Advice.Thrown Throwable throwable,
229-
@Advice.Enter AdviceScope adviceScope) {
229+
@Advice.Enter WithSpanAttributesAdviceScope adviceScope) {
230230
if (adviceScope != null) {
231231
return adviceScope.end(returnValue, throwable);
232232
}

instrumentation/opentelemetry-instrumentation-annotations-1.16/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/instrumentationannotations/WithSpanInstrumentation.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,26 @@ public void transform(TypeTransformer transformer) {
8282
@SuppressWarnings("unused")
8383
public static class WithSpanAdvice {
8484

85-
public static class AdviceScope {
85+
public static class WithSpanAdviceScope {
8686
private final Method method;
8787
private final Context context;
8888
private final Scope scope;
8989

90-
public AdviceScope(Method method, Context context, Scope scope) {
90+
public WithSpanAdviceScope(Method method, Context context, Scope scope) {
9191
this.method = method;
9292
this.context = context;
9393
this.scope = scope;
9494
}
9595

9696
@Nullable
97-
public static AdviceScope start(Method method) {
97+
public static WithSpanAdviceScope start(Method method) {
9898
Instrumenter<Method, Object> instrumenter = instrumenter();
9999
Context current = AnnotationSingletons.getContextForMethod(method);
100100
if (!instrumenter.shouldStart(current, method)) {
101101
return null;
102102
}
103103
Context context = instrumenter.start(current, method);
104-
return new AdviceScope(method, context, context.makeCurrent());
104+
return new WithSpanAdviceScope(method, context, context.makeCurrent());
105105
}
106106

107107
public Object end(@Nullable Object returnValue, @Nullable Throwable throwable) {
@@ -114,18 +114,18 @@ public Object end(@Nullable Object returnValue, @Nullable Throwable throwable) {
114114

115115
@Nullable
116116
@Advice.OnMethodEnter(suppress = Throwable.class)
117-
public static AdviceScope onEnter(@Advice.Origin Method originMethod) {
117+
public static WithSpanAdviceScope onEnter(@Advice.Origin Method originMethod) {
118118
// Every usage of @Advice.Origin Method is replaced with a call to Class.getMethod, copy it
119119
// to advice scope so that there would be only one call to Class.getMethod.
120-
return AdviceScope.start(originMethod);
120+
return WithSpanAdviceScope.start(originMethod);
121121
}
122122

123123
@AssignReturned.ToReturned
124124
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
125125
public static Object stopSpan(
126126
@Advice.Return(typing = Assigner.Typing.DYNAMIC) Object returnValue,
127127
@Advice.Thrown @Nullable Throwable throwable,
128-
@Advice.Enter @Nullable AdviceScope adviceScope) {
128+
@Advice.Enter @Nullable WithSpanAdviceScope adviceScope) {
129129
if (adviceScope != null) {
130130
return adviceScope.end(returnValue, throwable);
131131
}
@@ -136,29 +136,30 @@ public static Object stopSpan(
136136
@SuppressWarnings("unused")
137137
public static class WithSpanAttributesAdvice {
138138

139-
public static class AdviceScope {
139+
public static class WithSpanAttributesAdviceScope {
140140
private final Method method;
141141
private final MethodRequest request;
142142
private final Context context;
143143
private final Scope scope;
144144

145-
public AdviceScope(Method method, MethodRequest request, Context context, Scope scope) {
145+
public WithSpanAttributesAdviceScope(
146+
Method method, MethodRequest request, Context context, Scope scope) {
146147
this.method = method;
147148
this.request = request;
148149
this.context = context;
149150
this.scope = scope;
150151
}
151152

152153
@Nullable
153-
public static AdviceScope start(Method method, Object[] args) {
154+
public static WithSpanAttributesAdviceScope start(Method method, Object[] args) {
154155
Instrumenter<MethodRequest, Object> instrumenter = instrumenterWithAttributes();
155156
Context current = AnnotationSingletons.getContextForMethod(method);
156157
MethodRequest request = new MethodRequest(method, args);
157158
if (!instrumenter.shouldStart(current, request)) {
158159
return null;
159160
}
160161
Context context = instrumenter.start(current, request);
161-
return new AdviceScope(method, request, context, context.makeCurrent());
162+
return new WithSpanAttributesAdviceScope(method, request, context, context.makeCurrent());
162163
}
163164

164165
public Object end(@Nullable Object returnValue, @Nullable Throwable throwable) {
@@ -172,21 +173,21 @@ public Object end(@Nullable Object returnValue, @Nullable Throwable throwable) {
172173

173174
@Nullable
174175
@Advice.OnMethodEnter(suppress = Throwable.class)
175-
public static AdviceScope onEnter(
176+
public static WithSpanAttributesAdviceScope onEnter(
176177
@Advice.Origin Method originMethod,
177178
@Advice.AllArguments(typing = Assigner.Typing.DYNAMIC) Object[] args) {
178179

179180
// Every usage of @Advice.Origin Method is replaced with a call to Class.getMethod, copy it
180181
// to advice scope so that there would be only one call to Class.getMethod.
181-
return AdviceScope.start(originMethod, args);
182+
return WithSpanAttributesAdviceScope.start(originMethod, args);
182183
}
183184

184185
@AssignReturned.ToReturned
185186
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
186187
public static Object stopSpan(
187188
@Advice.Return(typing = Assigner.Typing.DYNAMIC) Object returnValue,
188189
@Advice.Thrown Throwable throwable,
189-
@Advice.Enter AdviceScope adviceScope) {
190+
@Advice.Enter WithSpanAttributesAdviceScope adviceScope) {
190191
if (adviceScope != null) {
191192
return adviceScope.end(returnValue, throwable);
192193
}

0 commit comments

Comments
 (0)