Skip to content
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

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

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 Draft: fix(inputs.chrony): Support local sources Jun 21, 2024
@Frankkkkk Frankkkkk changed the title Draft: fix(inputs.chrony): Support local sources fix(inputs.chrony): Support local (reference) sources Jun 21, 2024
Copy link
Contributor

@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?

plugins/inputs/chrony/chrony.go Outdated Show resolved Hide resolved
@srebhan srebhan self-assigned this Jun 24, 2024
Copy link
Contributor

@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.

plugins/inputs/chrony/chrony.go Outdated Show resolved Hide resolved
plugins/inputs/chrony/chrony.go Outdated Show resolved Hide resolved
@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
Contributor

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!

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
Copy link
Contributor Author

@srebhan done

Copy link
Contributor

@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 DStrand1 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[chrony] sourcestats metrics don't work on stratum-1 servers
4 participants