Skip to content

fix(inputs.chrony): Support local (reference) sources #15551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

Frankkkkk
Copy link
Contributor

Summary

Local sources are directly connected to the server (PPS inputs from oscillators, GPS, etc..). They can be seen as stratum-0 sources.

The standard way of getting their name doesn't work as it is stored into their RefID instead.

This fixes that

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #15550

@telegraf-tiger
Copy link
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger bot added fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jun 21, 2024
@Frankkkkk
Copy link
Contributor Author

!signed-cla

@Frankkkkk Frankkkkk changed the title fix(inputs.chrony): Support local sources Jun 21, 2024
@Frankkkkk Frankkkkk force-pushed the chrony-local-sources branch from 01cff75 to 5205e0a Compare June 21, 2024 22:11
@Frankkkkk Frankkkkk changed the title Draft: fix(inputs.chrony): Support local sources Jun 21, 2024
@Frankkkkk Frankkkkk force-pushed the chrony-local-sources branch from 5205e0a to b834e14 Compare June 23, 2024 22:17
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks @Frankkkkk! Just a small comment regarding the comment. ;-) Maybe we could also move the peer-extraction to a function to avoid having to comment the special cases in two places?

@srebhan srebhan self-assigned this Jun 24, 2024
@Frankkkkk Frankkkkk force-pushed the chrony-local-sources branch from b834e14 to 8f47c6b Compare June 24, 2024 08:17
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks for the quick update! Please move all source-name logic into the now function as this makes the code in gather more readable.

@Frankkkkk
Copy link
Contributor Author

Frankkkkk commented Jun 24, 2024

I don't understand what you mean by "source-name logic into the now function" as they are different:

  • gatherSources works on a SourceData in which the name is encoded into the IPv4
  • gatherSourcesStats works on a SourceStats, in which the name is encoded into the RefID
    The logic for decoding is different (IP == "::" vs mode = sourceModeRef)

Cheers

@srebhan
Copy link
Member

srebhan commented Jun 24, 2024

@Frankkkkk I see, didn't notice that the type is different. So keep the code locations but remove the link to the other repository!

@Frankkkkk Frankkkkk force-pushed the chrony-local-sources branch from 8f47c6b to cc9e21c Compare June 24, 2024 15:30
Local sources are directly connected to the server (PPS inputs from
oscillators, GPS, etc..). They can be seen as stratum-0 sources.

The standard way of getting their name doesn't work as it is stored into
their RefID instead.

See the following links for more details:
- https://gitlab.com/chrony/chrony/-/blob/05bd4898a9a64fe1e5432a78939c4b4b82619c2f/client.c?page=3#L2046
- https://gitlab.com/chrony/chrony/-/blob/05bd4898a9a64fe1e5432a78939c4b4b82619c2f/client.c?page=3#L2152

This fixes that

Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
@Frankkkkk Frankkkkk force-pushed the chrony-local-sources branch from cc9e21c to 1a29326 Compare June 24, 2024 15:35
@Frankkkkk
Copy link
Contributor Author

@srebhan done

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @Frankkkkk!

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jun 24, 2024
@srebhan srebhan assigned powersj and mstrandboge and unassigned srebhan Jun 24, 2024
@powersj powersj merged commit 5a46c0a into influxdata:master Jun 25, 2024
27 checks passed
@github-actions github-actions bot added this to the v1.31.1 milestone Jun 25, 2024
srebhan pushed a commit that referenced this pull request Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
4 participants