diff --git a/README.md b/README.md index 60b6b2b9..6cc430bb 100644 --- a/README.md +++ b/README.md @@ -64,4 +64,5 @@ Also there are several documents that you may find useful: - [How it works](./docs/how-it-works.md) - [How to add a new rule](./docs/how-to-add-a-new-rule.md) -- [Discussion on this topic at OpenTelemetry community](https://github.com/open-telemetry/community/issues/1961) \ No newline at end of file +- [Discussion on this topic at OpenTelemetry community](https://github.com/open-telemetry/community/issues/1961) +- [面向OpenTelemetry的Golang应用无侵入插桩技术](https://mp.weixin.qq.com/s/FKCwzRB5Ujhe1stOH2ibXg) diff --git a/tool/instrument/trampoline.go b/tool/instrument/trampoline.go index e7b74dbf..9898c846 100644 --- a/tool/instrument/trampoline.go +++ b/tool/instrument/trampoline.go @@ -375,6 +375,17 @@ func (rp *RuleProcessor) replenishCallContext(onEnter bool) bool { return false } +// ----------------------------------------------------------------------------- +// Dynamic CallContext API Generation +// +// This is somewhat challenging, as we need to generate type-aware CallContext +// APIs, which means we need to generate a bunch of switch statements to handle +// different types of parameters. Different RawFuncs in the same package may have +// different types of parameters, all of them should have their own CallContext +// implementation, thus we need to generate a bunch of CallContextImpl{suffix} +// types and methods to handle them. The suffix is generated based on the rule +// suffix, so that we can distinguish them from each other. + // implementCallContext effectively "implements" the CallContext interface by // renaming occurrences of CallContextImpl to CallContextImpl{suffix} in the // trampoline template