-
Notifications
You must be signed in to change notification settings - Fork 329
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
WIP: Moved kamon-netty #1113
base: master
Are you sure you want to change the base?
WIP: Moved kamon-netty #1113
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package kamon.netty.instrumentation.advisor; | ||
|
||
import io.netty.channel.ChannelHandlerContext; | ||
import io.netty.handler.codec.http.HttpRequest; | ||
import kamon.netty.instrumentation.HttpRequestContext; | ||
import kanela.agent.libs.net.bytebuddy.asm.Advice.Argument; | ||
import kanela.agent.libs.net.bytebuddy.asm.Advice.OnMethodEnter; | ||
|
||
public class ClientEncodeMethodAdvisor { | ||
|
||
@OnMethodEnter | ||
static void onEnter(@Argument(value = 0) ChannelHandlerContext ctx, | ||
@Argument(value = 1, readOnly = false) Object request) { | ||
if (request instanceof HttpRequest) { | ||
request = HttpRequestContext.withContext((HttpRequest)request, ctx); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package kamon.netty.instrumentation.advisor; | ||
|
||
import io.netty.channel.EventLoop; | ||
import java.util.Queue; | ||
import kamon.netty.util.MonitoredQueue; | ||
import kanela.agent.libs.net.bytebuddy.asm.Advice.OnMethodExit; | ||
import kanela.agent.libs.net.bytebuddy.asm.Advice.Return; | ||
import kanela.agent.libs.net.bytebuddy.asm.Advice.This; | ||
|
||
public class NewTaskQueueMethodAdvisor { | ||
|
||
@OnMethodExit | ||
static void onExit(@This Object eventLoop, @Return(readOnly = false) Queue<Runnable> queue) { | ||
MonitoredQueue.apply((EventLoop) eventLoop, queue); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the method that would fail on more recent Netty versions because |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/* | ||
* ========================================================================================= | ||
* Copyright © 2013-2017 the kamon project <http://kamon.io/> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
* except in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the | ||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
* ========================================================================================= | ||
*/ | ||
|
||
|
||
package kamon.netty.util; | ||
|
||
import java.util.Collection; | ||
import java.util.Iterator; | ||
import java.util.Queue; | ||
|
||
public class QueueWrapperAdapter<E> implements Queue<E> { | ||
|
||
private final Queue<E> underlying; | ||
|
||
public QueueWrapperAdapter(Queue<E> underlying) { | ||
this.underlying = underlying; | ||
} | ||
|
||
@Override | ||
public int size() { | ||
return underlying.size(); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return underlying.isEmpty(); | ||
} | ||
|
||
@Override | ||
public boolean contains(Object o) { | ||
return underlying.contains(o); | ||
} | ||
|
||
@Override | ||
public Iterator<E> iterator() { | ||
return underlying.iterator(); | ||
} | ||
|
||
@Override | ||
public Object[] toArray() { | ||
return underlying.toArray(); | ||
} | ||
|
||
@Override | ||
public <T> T[] toArray(T[] a) { | ||
return underlying.toArray(a); | ||
} | ||
|
||
@Override | ||
public boolean add(E e) { | ||
return underlying.add(e); | ||
} | ||
|
||
@Override | ||
public boolean remove(Object o) { | ||
return underlying.remove(o); | ||
} | ||
|
||
@Override | ||
public boolean containsAll(Collection<?> c) { | ||
return underlying.containsAll(c); | ||
} | ||
|
||
@Override | ||
public boolean addAll(Collection<? extends E> c) { | ||
return underlying.addAll(c); | ||
} | ||
|
||
@Override | ||
public boolean removeAll(Collection<?> c) { | ||
return underlying.removeAll(c); | ||
} | ||
|
||
@Override | ||
public boolean retainAll(Collection<?> c) { | ||
return underlying.retainAll(c); | ||
} | ||
|
||
@Override | ||
public void clear() { | ||
underlying.clear(); | ||
} | ||
|
||
@Override | ||
public boolean offer(E e) { | ||
return underlying.offer(e); | ||
} | ||
|
||
@Override | ||
public E remove() { | ||
return underlying.remove(); | ||
} | ||
|
||
@Override | ||
public E poll() { | ||
return underlying.poll(); | ||
} | ||
|
||
@Override | ||
public E element() { | ||
return underlying.element(); | ||
} | ||
|
||
@Override | ||
public E peek() { | ||
return underlying.peek(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this file |
||
|
||
<aspectj> | ||
<aspects> | ||
<aspect name="kamon.netty.instrumentation.mixin.ChannelInstrumentation"/> | ||
<aspect name="kamon.netty.instrumentation.EventLoopMixin"/> | ||
<aspect name="kamon.netty.instrumentation.ServerBootstrapInstrumentation"/> | ||
<aspect name="kamon.netty.instrumentation.EventLoopInstrumentation"/> | ||
<aspect name="kamon.netty.instrumentation.EpollEventLoopInstrumentation"/> | ||
<aspect name="kamon.netty.instrumentation.HttpClientInstrumentation"/> | ||
<aspect name="kamon.netty.instrumentation.HttpServerInstrumentation"/> | ||
</aspects> | ||
<weaver> | ||
<include within="kamon.netty..*"/> | ||
<include within="io.netty..*"/> | ||
</weaver> | ||
</aspectj> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<configuration> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this file. You might add one under test/resources for testing purposes, but we can't include a |
||
|
||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="debug"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move all the code to the
kamon.instrumentation.netty
package to follow the same conventions across all projects