Skip to content

Conversation

@dmitryk-dk
Copy link
Contributor

@dmitryk-dk dmitryk-dk commented Jul 7, 2025

implement tenants endpoint for victorialogs

Describe Your Changes

Implemented endpoint like VictoriaMetrics has /select/admin/tenants. This endpoint returns tenants from the storage as slice of strings like []{"0:0", "1:0"}.
This endpoint can help to build UI with requests per tenant.

{
  "status": "success",
  "data": [
    "0:0",
    "2:1",
    "3:1"
  ]
}

Checked both solutions, single version and cluster. Fixed all comments from this VictoriaMetrics/VictoriaMetrics#7484

Checklist

The following checks are mandatory:

@dmitryk-dk dmitryk-dk requested a review from vadimalekseev July 9, 2025 15:03
@dmitryk-dk dmitryk-dk requested a review from vadimalekseev July 10, 2025 08:11
vadimalekseev
vadimalekseev previously approved these changes Jul 10, 2025
Copy link
Member

@vadimalekseev vadimalekseev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Someone please verify the logic of tenants parsing

@valyala
Copy link
Contributor

valyala commented Oct 13, 2025

@dmitryk-dk , could you rebase this pull request on top of the #709 ?

@jiekun
Copy link
Member

jiekun commented Oct 13, 2025

Let me do this. I promised to rebase this PR after my one. cc @dmitryk-dk I'm working on it now.

OK dk is 1 step ahead of me so I'll leave the rebase work to him. Let me know if anything I can help with.

@dmitryk-dk
Copy link
Contributor Author

@dmitryk-dk , could you rebase this pull request on top of the #709 ?

Hi @valyala , @jiekun ! I have rebased the code to this branch.

1. Run first storage
 ./victoria-logs-darwin-arm64 -httpListenAddr=:9491 -storageDataPath=victoria-logs-data-1
 2. Run second storage
 ./victoria-logs-darwin-arm64 -httpListenAddr=:9492 -storageDataPath=victoria-logs-data-2
 3. Run service (insert, select)
 ./victoria-logs-darwin-arm64 -httpListenAddr=:9481 -storageNode=localhost:9491,localhost:9492
4. Run service (insert, select)
 ./victoria-logs-darwin-arm64 -httpListenAddr=:9471 -storageNode=localhost:9491,localhost:9492

Write data

echo '{"create":{}} 
{"_msg":"cannot open file","_time":"0","host.name":"host123"}
' | curl -X POST -H 'Content-Type: application/json' -H 'AccountID:5' -H 'ProjectID:2' --data-binary @- http://localhost:9471/insert/elasticsearch/_bulk
{"took":0,"errors":false,"items":[{"create":{"status":201}}]}                                                                                        

Select tenants

 curl -X POST -H 'Content-Type: application/json' http://localhost:9481/select/admin/tenants
{"status":"success","data":["2:1","5:2","5:10"]}

Checked the same for the single

 curl -X POST -H 'Content-Type: application/json' http://localhost:9428/select/admin/tenants                                                      
{"status":"success","data":["5:2"]}%                        

valyala added a commit that referenced this pull request Nov 7, 2025
…nd `non-existing-non-empty-tag-re`

This is a follow-up for 918ccca .

See also #417 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants