-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #327 from newrelic/feature/grpc-inst/endpoint
API Endpoint and User Class Detection support for gRPC
- Loading branch information
Showing
10 changed files
with
161 additions
and
10 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...mentation-security/grpc-1.22.0/src/main/java/io/grpc/BindableService_Instrumentation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.grpc; | ||
|
||
import com.newrelic.agent.security.instrumentation.grpc1220.GrpcUtils; | ||
import com.newrelic.api.agent.security.NewRelicSecurity; | ||
import com.newrelic.api.agent.security.instrumentation.helpers.URLMappingsHelper; | ||
import com.newrelic.api.agent.security.schema.ApplicationURLMapping; | ||
import com.newrelic.api.agent.security.utils.logging.LogLevel; | ||
import com.newrelic.api.agent.weaver.MatchType; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
|
||
@Weave(originalName = "io.grpc.BindableService", type = MatchType.Interface) | ||
public class BindableService_Instrumentation { | ||
public ServerServiceDefinition bindService() { | ||
ServerServiceDefinition returnValue = Weaver.callOriginal(); | ||
|
||
try { | ||
String handler = this.getClass().getName(); | ||
for (ServerMethodDefinition<?, ?> serverMethod : returnValue.getMethods()) { | ||
MethodDescriptor<?, ?> methodDescriptor = serverMethod.getMethodDescriptor(); | ||
String url = methodDescriptor.getFullMethodName(); | ||
String methodType = methodDescriptor.getType().name(); | ||
URLMappingsHelper.addApplicationURLMapping(new ApplicationURLMapping(methodType, url, handler)); | ||
} | ||
} catch (Exception e){ | ||
String message = "Instrumentation library: %s , error while getting app endpoints : %s"; | ||
NewRelicSecurity.getAgent().log(LogLevel.WARNING, String.format(message, GrpcUtils.GRPC_1_22_0, e.getMessage()), e, this.getClass().getName()); | ||
} | ||
|
||
return returnValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...umentation-security/grpc-1.4.0/src/main/java/io/grpc/BindableService_Instrumentation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.grpc; | ||
|
||
import com.newrelic.agent.security.instrumentation.grpc140.GrpcUtils; | ||
import com.newrelic.api.agent.security.NewRelicSecurity; | ||
import com.newrelic.api.agent.security.instrumentation.helpers.URLMappingsHelper; | ||
import com.newrelic.api.agent.security.schema.ApplicationURLMapping; | ||
import com.newrelic.api.agent.security.utils.logging.LogLevel; | ||
import com.newrelic.api.agent.weaver.MatchType; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
|
||
@Weave(originalName = "io.grpc.BindableService", type = MatchType.Interface) | ||
public class BindableService_Instrumentation { | ||
public ServerServiceDefinition bindService() { | ||
ServerServiceDefinition returnValue = Weaver.callOriginal(); | ||
|
||
try { | ||
String handler = this.getClass().getName(); | ||
for (ServerMethodDefinition<?, ?> serverMethod : returnValue.getMethods()) { | ||
MethodDescriptor<?, ?> methodDescriptor = serverMethod.getMethodDescriptor(); | ||
String url = methodDescriptor.getFullMethodName(); | ||
String methodType = methodDescriptor.getType().name(); | ||
URLMappingsHelper.addApplicationURLMapping(new ApplicationURLMapping(methodType, url, handler)); | ||
} | ||
} catch (Exception e){ | ||
String message = "Instrumentation library: %s , error while getting app endpoints : %s"; | ||
NewRelicSecurity.getAgent().log(LogLevel.WARNING, String.format(message, GrpcUtils.GRPC_1_4_0, e.getMessage()), e, this.getClass().getName()); | ||
} | ||
|
||
return returnValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...mentation-security/grpc-1.40.0/src/main/java/io/grpc/BindableService_Instrumentation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.grpc; | ||
|
||
import com.newrelic.agent.security.instrumentation.grpc1400.GrpcUtils; | ||
import com.newrelic.api.agent.security.NewRelicSecurity; | ||
import com.newrelic.api.agent.security.instrumentation.helpers.URLMappingsHelper; | ||
import com.newrelic.api.agent.security.schema.ApplicationURLMapping; | ||
import com.newrelic.api.agent.security.utils.logging.LogLevel; | ||
import com.newrelic.api.agent.weaver.MatchType; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
|
||
@Weave(originalName = "io.grpc.BindableService", type = MatchType.Interface) | ||
public class BindableService_Instrumentation { | ||
public ServerServiceDefinition bindService() { | ||
ServerServiceDefinition returnValue = Weaver.callOriginal(); | ||
|
||
try { | ||
String handler = this.getClass().getName(); | ||
for (ServerMethodDefinition<?, ?> serverMethod : returnValue.getMethods()) { | ||
MethodDescriptor<?, ?> methodDescriptor = serverMethod.getMethodDescriptor(); | ||
String url = methodDescriptor.getFullMethodName(); | ||
String methodType = methodDescriptor.getType().name(); | ||
URLMappingsHelper.addApplicationURLMapping(new ApplicationURLMapping(methodType, url, handler)); | ||
} | ||
} catch (Exception e){ | ||
String message = "Instrumentation library: %s , error while getting app endpoints : %s"; | ||
NewRelicSecurity.getAgent().log(LogLevel.WARNING, String.format(message, GrpcUtils.GRPC_1_40_0, e.getMessage()), e, this.getClass().getName()); | ||
} | ||
|
||
return returnValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters