Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upfile_sd never stop update 'custom_sd.json' file #4541
Comments
This comment has been minimized.
This comment has been minimized.
|
/cc @cstyan |
This comment has been minimized.
This comment has been minimized.
|
I would like to submit this PR |
This comment has been minimized.
This comment has been minimized.
|
Hi, thanks a lot for offering, please go ahead. I just linked Callum as he was the one who wrote the code and has most context. |
earthdiaosi
referenced this issue
Aug 27, 2018
Closed
fix file_sd never stop update 'custom_sd.json' file #4542
This comment has been minimized.
This comment has been minimized.
|
Hi @earthdiaosi can you show us what your Additionally, if there is a bug it's in the adapter code. Discovery manager should not have to be modified. |
This comment has been minimized.
This comment has been minimized.
|
i write a demo to reproduce the bug:
|
cstyan
referenced this issue
Aug 28, 2018
Closed
fix bug in SD adapter that would result in writing the output even if target groups had not changed #4555
This comment has been minimized.
This comment has been minimized.
|
Thanks for the example! I was able to find and fix the bug. See: #4555 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@earthdiaosi Yeah! So I'm not sure if there's a workaround for that, or if the fix is to just vendor that package. Depends what the team wants to do. Are you able to check out my changes and try them with your custom SD implementation? Let me know if they don't work for you and we can look at it more together! |
This comment has been minimized.
This comment has been minimized.
|
I'd avoid using that package, it's not something we use elsewhere and we should try to keep this example reasonably standard. |
This comment has been minimized.
This comment has been minimized.
|
@earthdiaosi if you'd like, you could take my open PR and make the changes to make the hashing of the structures that contain maps consistent without using the Changes should be to the code in the example dir ( |
earthdiaosi
referenced this issue
Sep 1, 2018
Merged
fix file_sd never stop update 'custom_sd.json' file in adapter.go #4567
This comment has been minimized.
This comment has been minimized.
|
@cstyan I debug the code of hashstructure.go, but the code is too heavy. So I wrote a simplified version of the hash function for customSD。 Algorithm logic:
|
This comment has been minimized.
This comment has been minimized.
|
@earthdiaosi awesome, can you add that functionality to |



earthdiaosi commentedAug 27, 2018
•
edited
Proposal
Use case. Why is this important?
I want to implement custom service discovery, so i read the follow blog and wirte a demo;
but i found "custom_sd.json" file was updated each time. so i debug the follow code, and find
keyandiis different each time:then i search code, fount the reason: the
tsetsis a map, so the results are different for each iteration;solution: sort map by key
Bug Report
What did you do?
Write code to implement custom service discovery;
What did you expect to see?
Do not update file "custom_sd.json" when no changes;
What did you see instead? Under which circumstances?
i found "custom_sd.json" file was updated each time.
Environment
System information:
Windows7 64bit
Prometheus version:
2.3.1