-
Notifications
You must be signed in to change notification settings - Fork 147
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
autogenerate integrations.json #232
Conversation
…to Integrations folder
…ure for overload resolution
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.
I think it makes sense, another pair of eyes is important :)
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.
LGTM
|
||
// find all methods in Datadog.Trace.ClrProfiler.Managed.dll with [InterceptMethod] | ||
// and create objects that will generate correct JSON schema | ||
var integrations = from wrapperType in integrationsAssembly.GetTypes() |
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.
This is the longest LINQ query I've seen 😄
var genericArguments = method.GetGenericArguments(); | ||
|
||
var newSignatureBytes = new byte[signatureBytes.Length + 1]; | ||
newSignatureBytes[0] = (byte)(signatureBytes[0] | 0x10); |
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.
Nit: would be nice to name 0x10 IMAGE_CEE_CS_CALLCONV_GENERIC
or something similar for code readability
This PR adds a tool that can generate the
integrations.json
file from declaration in code, reducing manual work when adding new integrations and reducing the chance of errors, since it can automatically determine many values, such as the wrapper method's signature blob.Usage:
[InterceptMethod]
attributeFor example, to intercept method
System.Web.Mvc.Async.IAsyncActionInvoker.BeginInvokeAction()
inSystem.Web.Mvc.dll
:This PR also renames some integrations and move them to the
Integrations
folder for consistency:Pipeline
toElasticsearchNetIntegration
RedisNativeClient
toServiceStachRedisIntegration
For now, we will run this tool manually and check the results before committing changes to
integrations.json
. Later we can run it as part of the build process.