Skip to content

Conversation

@ymkins
Copy link
Contributor

@ymkins ymkins commented Sep 27, 2024

Summary

[outputs.groundwork] update SDK

TCG SDK that provides client used for sending data to Groundwork Monitoring has updated.
Modern version got fixes and features. Internal logger was changed to slog for simplify integrations.

PR provides telegraf.Logger adapter for slog.Logger used in SDK. It allows to output SDK messages with Telegraf logger.

Also PR provides improvement to filter out non-UTF symbols in payloads.

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #15945

@telegraf-tiger telegraf-tiger bot added the chore label Sep 27, 2024
@ymkins
Copy link
Contributor Author

ymkins commented Sep 27, 2024

$ make lint plugins/outputs/groundwork/
golangci-lint run
plugins/outputs/groundwork/slog/slog.go:6:2  depguard  import 'log/slog' is not allowed from list 'main': Use injected telegraf.Logger instead
1 issues:
* depguard: 1
make: *** [Makefile:191: lint] Error 1

This package implements telegraf.Logger adapter for slog.Logger used in library. It's used to output library messages with Telegraf logger.

@ymkins ymkins force-pushed the feat/groundwork-output branch from 5058565 to f94db3c Compare September 27, 2024 19:35
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 a lot for you work @ymkins! I think you should tailor the implementation of the adapter to the concrete use-case here. Furthermore, I'm not convinced that logging library-internal messages with their log-level is the right approach. I would log all library-internal messages as level Trace to allow used to silence them as usually those should not be interesting for anyone...

@srebhan srebhan self-assigned this Sep 30, 2024
Update the implementation of the adapter for address review comments
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 update @ymkins! Some more comments, with the most sever being the request to not work-around logging in tests.

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.

@ymkins thanks for clarifying my questions, just two small requests and a suggestion to silence the linter warning...

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.

@ymkins the code looks good, but I really urge you to just Init() the plugin instead of manually injecting stuff as this will not test for any errors when setting up logging in Init()!

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.

Awesome @ymkins! Thanks for all your effort and patience!

@srebhan srebhan added dependencies Pull requests that update a dependency file ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. labels Oct 8, 2024
@srebhan srebhan changed the title chore(deps): Update github.com/gwos/tcg/sdk from v8.7.2 to v8.8.0 Oct 8, 2024
@srebhan srebhan assigned mstrandboge and unassigned srebhan Oct 8, 2024
@mstrandboge mstrandboge merged commit ed6d8ae into influxdata:master Oct 8, 2024
28 of 29 checks passed
@github-actions github-actions bot added this to the v1.32.2 milestone Oct 8, 2024
@ymkins ymkins deleted the feat/groundwork-output branch October 10, 2024 14:25
asaharn pushed a commit to asaharn/telegraf that referenced this pull request Oct 16, 2024
…uxdata#15947)

Co-authored-by: Pavlo Sumkin <pavlo@bluesunrise.com>
Co-authored-by: VladislavSenkevich <mr.senkevich@gmail.com>
srebhan pushed a commit that referenced this pull request Oct 28, 2024
Co-authored-by: Pavlo Sumkin <pavlo@bluesunrise.com>
Co-authored-by: VladislavSenkevich <mr.senkevich@gmail.com>
(cherry picked from commit ed6d8ae)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore dependencies Pull requests that update a dependency file 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