Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
My sibyl2 server is deployed in k8s,here is the yaml file
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "8"
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"sibyl2-deployment","namespace":"devops-qa"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"sibyl2"}},"template":{"metadata":{"labels":{"app":"sibyl2"}},"spec":{"containers":[{"env":[{"name":"SIBYL2_BINDING_DBTYPE","value":"MONGO"},{"name":"SIBYL2_BINDING_MONGO_DB_NAME","value":"sibyl2"},{"name":"SIBYL2_BINDING_MONGO_URI","value":"mongodb://root:example@mongo-service:27017/"}],"image":"williamfzc/sibyl2:v0.16.1","name":"sibyl2","ports":[{"containerPort":9876}]}]}}}}
creationTimestamp: "2023-07-25T05:58:24Z"
generation: 9
name: sibyl2-deployment
namespace: devops-qa
resourceVersion: "112989345"
uid: 967e7cf4-c4fa-4a2b-b4ab-9be54a12a84b
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: sibyl2
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
redeploy-timestamp: "1690861224325"
creationTimestamp: null
labels:
app: sibyl2
spec:
containers:
- env:
- name: SIBYL2_BINDING_DBTYPE
value: MONGO
- name: SIBYL2_BINDING_MONGO_DB_NAME
value: sibyl2
- name: SIBYL2_BINDING_MONGO_URI
value: mongodb://root:example@mongo-service:27017/
image: williamfzc/sibyl2:v0.16.4
imagePullPolicy: IfNotPresent
name: sibyl2
ports:
- containerPort: 9876
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 1
conditions:
- lastTransitionTime: "2023-07-25T05:59:16Z"
lastUpdateTime: "2023-07-25T05:59:16Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
- lastTransitionTime: "2023-07-25T05:58:24Z"
lastUpdateTime: "2023-08-01T06:29:21Z"
message: ReplicaSet "sibyl2-deployment-764bd6fc4" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
observedGeneration: 9
readyReplicas: 1
replicas: 1
updatedReplicas: 1As u can see ,the version of sibyl2 image is v0.16.4. After I upload the source file ,i want to tag some function.
1.Tag A Func
curl -X 'POST' \
'http://devops-sibyl.qa.xxxx.com/api/v1/tag/func' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"repoId": "api-detect-test-app+test",
"revHash": "d5e4a807-test",
"signature": "com.xxx.data.fetch.service.web.controller|com.xxx.data.fetch.service.web.controller.UserActionDashboardController|allBoard|String|List<DataFetchBoardDTO>",
"tag": "thisIsATestTag"
}'
The respones http status code is 200
2.Query the Tag
curl -X 'GET' \
'http://devops-sibyl.qa.xxx.com/api/v1/tag/func?repo=api-detect-test-app%2Btest&rev=d5e4a807-test&tag=thisIsATestTag' \
-H 'accept: application/json'response is
[
"com.xxx.data.fetch.service.web.controller|com.xxx.data.fetch.service.web.controller.UserActionDashboardController|allBoard|String|List<DataFetchBoardDTO>"
]
which is in line with expectations
3.here is something weird happen, when i use the /api/v1/regex/func to match the tag field ,the result is wrong
curl -X 'GET' \
'http://devops-sibyl.qa.xxx.com/api/v1/regex/func?repo=api-detect-test-app%2Btest&rev=d5e4a807-test&field=tags®ex=.*this.*' \
-H 'accept: application/json'
The response is
[]
This means that through this api, I have not obtained the information of the function that was tagged just now.
And when I get the information of the function through the signature, I don't see the related tag info in the returned data
curl -X 'GET' \
'http://devops-sibyl.qa.xxx.com/api/v1/signature/func?repo=api-detect-test-app%2Btest&rev=d5e4a807-test&signature=com.xxx.data.fetch.service.web.controller%7Ccom.xxx.data.fetch.service.web.controller.UserActionDashboardController%7CallBoard%7CString%7CList%3CDataFetchBoardDTO%3E' \
-H 'accept: application/json'
response
{
"name": "allBoard",
"receiver": "com.xxx.data.fetch.service.web.controller.UserActionDashboardController",
"namespace": "com.xxx.data.fetch.service.web.controller",
"parameters": [
{
"type": "String",
"name": "keyword"
}
],
"returns": [
{
"type": "List<DataFetchBoardDTO>",
"name": ""
}
],
"defLine": 60,
"span": {
"start": {
"row": 58,
"column": 4
},
"end": {
"row": 64,
"column": 5
}
},
"bodySpan": {
"start": {
"row": 59,
"column": 59
},
"end": {
"row": 64,
"column": 5
}
},
"extras": {
"annotations": [
"@GetMapping(\"/allBoard\")"
],
"classInfo": [
{
"Key": "packageName",
"Value": "com.xxx.data.fetch.service.web.controller"
},
{
"Key": "className",
"Value": "UserActionDashboardController"
},
{
"Key": "annotations",
"Value": [
"@RestController",
"@RequestMapping(\"/userAction/dashboard\")"
]
}
]
},
"lang": "JAVA",
"path": "xxx-data-fetch-service-web/src/main/java/com/xxx/data/fetch/service/web/controller/UserActionDashboardController.java",
"tags": [],
"signature": "com.xxx.data.fetch.service.web.controller|com.xxx.data.fetch.service.web.controller.UserActionDashboardController|allBoard|String|List<DataFetchBoardDTO>"
}
as u can see, the tag info is empty.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
No-SilverBullet commentedon Aug 1, 2023
Regardless of whether there is a problem with my use, the performance of the api is not as expected. I think this is a bug, and I hope to reply as soon as possible.Thanks
williamfzc commentedon Aug 1, 2023
Could you check if the tags have been properly written to the mongo storage for this method?
I 'm not sure if the issue is caused by escaping characters.
No-SilverBullet commentedon Aug 1, 2023
tag string is properly written into mongo storage.The tag query api is work but the regex query api does not work.....
williamfzc commentedon Aug 1, 2023
Is it still working if you query other fields (like
name)?Also you can query it with a specific field instead, or create another script to query the db directly if the mongo works fine.
No-SilverBullet commentedon Aug 2, 2023
other field's query is ok,i see there are two fields in mongoDb, 'tag' and 'tags' ,tag field has values but the other one has not.

Is this normal?hope this information can be useful
williamfzc commentedon Aug 2, 2023
OK cool. It looks like a typo.
Could you try using
field=taginstead?No-SilverBullet commentedon Aug 2, 2023
i tried,still not work
williamfzc commentedon Aug 2, 2023
bug from here:
https://github.com/opensibyl/sibyl2/blob/4cbbd3b42b2471efdd069e292528daf124792dba/pkg/server/binding/binding_mongo_create.go#L58C10-L58C10
The mongo driver uses a wrong key
tagin uploading.You can change it to
tagsto make it work immediately if it's urgent.Official fix should be released soon.
Thanks for your report :)
No-SilverBullet commentedon Aug 2, 2023
But I use sibyl2_0.16.4_darwin_amd64 on my pc, the tag function and regex query by tag field is ok.
williamfzc commentedon Aug 2, 2023
By default sibyl2 uses badger as db. Its implementation is correct.
Are you using mongo on your pc?
No-SilverBullet commentedon Aug 2, 2023
Got it ,I so the reason for this bug is that the field corresponding to mongoDb is
tagwhen creating a tag, but the tag query is through thetagsfield, so the query has no results. Am I right ?fix(#74): typo in tag
williamfzc commentedon Aug 3, 2023
This should be fixed in v0.16.5
test case:
sibyl2/pkg/server/binding/binding_mongo_test.go
Line 106 in 268de60
Feel free to reopen if it still exists.