You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "zealotjx (via GitHub)" <gi...@apache.org> on 2024/01/11 09:07:09 UTC
[I] [Bug] go agent enhance multiple arguments of the same type [skywalking]
zealotjx opened a new issue, #11753:
URL: https://github.com/apache/skywalking/issues/11753
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues.
### Apache SkyWalking Component
OAP server (apache/skywalking)
### What happened
When using go agent to enhance a function with multiple parameters of the same type, if the following writing method is used in the function: `func myFunc(x, y, z string) {}`, it can only be obtained `in invocation.Args() `of `Interceptor.BeforeInvoke` a parameter `x`
### What you expected to happen
I think we should be able to get the three parameters x, y and z
### How to reproduce
Enhance a function like the following
`func myFunc(x, y, z string) {}`
### Anything else
我查看源码发现遍历dst.Field.Names时,使用了break,此处是否应该为continue
`func EnhanceParameterNames(fields *dst.FieldList, fieldType FieldListType) []*ParameterInfo {
if fields == nil {
return nil
}
result := make([]*ParameterInfo, 0)
for i, f := range fields.List {
var defineName string
switch fieldType {
case FieldListTypeParam:
defineName = fmt.Sprintf("skywalking_param_%d", i)
case FieldListTypeResult:
defineName = fmt.Sprintf("skywalking_result_%d", i)
case FieldListTypeRecv:
defineName = fmt.Sprintf("skywalking_recv_%d", i)
}
if len(f.Names) == 0 {
f.Names = []*dst.Ident{{Name: defineName}}
result = append(result, newParameterInfo(defineName, f.Type))
} else {
for _, n := range f.Names {
if n.Name == "_" {
*n = *dst.NewIdent(defineName)
break
}
}
for _, n := range f.Names {
result = append(result, newParameterInfo(n.Name, f.Type))
break
}
}
}
return result
}`
### Are you willing to submit a pull request to fix on your own?
- [X] Yes I am willing to submit a pull request on my own!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] go agent enhance multiple arguments of the same type [skywalking]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on issue #11753:
URL: https://github.com/apache/skywalking/issues/11753#issuecomment-1887055574
For now, I think we only should single name of same type. If you can handle the multiple names, welcome to contribute the codes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] go agent enhance multiple arguments of the same type [skywalking]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng closed issue #11753: [Bug] go agent enhance multiple arguments of the same type
URL: https://github.com/apache/skywalking/issues/11753
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] go agent enhance multiple arguments of the same type [skywalking]
Posted by "mrproliu (via GitHub)" <gi...@apache.org>.
mrproliu commented on issue #11753:
URL: https://github.com/apache/skywalking/issues/11753#issuecomment-1887139007
Sure. It's just enhancement feature I think.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] go agent enhance multiple arguments of the same type [skywalking]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on issue #11753:
URL: https://github.com/apache/skywalking/issues/11753#issuecomment-1887133541
@mrproliu Should we move this to discussion?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org