-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat(outputs.quix): Add plugin #16144
base: master
Are you sure you want to change the base?
Conversation
First implementation - no defaults
Thanks so much for the pull request! |
|
1 similar comment
|
b7dcc9f
to
f32b854
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution @tomas-quix! I do have some comments in the code. Furthermore, I want to encourage you to implement some unit-tests for this plugin, e.g. by mocking the config server and using a quix docker container or at least using a kafka instance mocking the replies...
This plugin uses an SDK token for authentication with Quix. You can generate | ||
one in the settings under the `API and tokens` section by clicking on | ||
`SDK Token`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin uses an SDK token for authentication with Quix. You can generate | |
one in the settings under the `API and tokens` section by clicking on | |
`SDK Token`. | |
This plugin uses a SDK token for authentication with Quix. You can generate | |
one in the settings under the `API and tokens` section by clicking on | |
`SDK Token`. |
Do you also have a link here to some documentation section?
This plugin writes metrics to a [Quix](https://quix.io/) endpoint. | ||
|
||
Please consult Quix's [official documentation](https://quix.io/docs/) for more | ||
details on the Quix platform architecture and concepts. | ||
|
||
⭐ Telegraf v1.32.2 🏷️ cloud, messaging 💻 all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin writes metrics to a [Quix](https://quix.io/) endpoint. | |
Please consult Quix's [official documentation](https://quix.io/docs/) for more | |
details on the Quix platform architecture and concepts. | |
⭐ Telegraf v1.32.2 🏷️ cloud, messaging 💻 all | |
This plugin writes metrics to a [Quix](https://quix.io/) endpoint. | |
Please consult Quix's [official documentation][quick] for more | |
details on the Quix platform architecture and concepts. | |
⭐ Telegraf v1.33.0 🏷️ cloud, messaging 💻 all | |
[quix]: https://quix.io/docs/ |
For this output plugin to function correctly the following variables must be | ||
configured. | ||
|
||
* workspace | ||
* auth_token | ||
* topic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments on the sample.conf
file!
### data_format | ||
|
||
The data format for serializing the messages. Defaults to `json`. | ||
|
||
### timestamp_units | ||
|
||
The timestamp units for precision. Defaults to `1s` for one second. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you support any other setting with this version of the output? If not, please remove the options.
[[outputs.quix]] | ||
workspace = "your_workspace" | ||
auth_token = "your_auth_token" | ||
topic = "telegraf_metrics" | ||
api_url = "https://portal-api.platform.quix.io" | ||
data_format = "json" | ||
timestamp_units = "1s" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note, the first line of the config must be a comment containing a brief description of the plugin. All options must be documented starting with a double-hash! Default values must be commented with the value being the default using a single-hash.
Furthermore, you should shorten the option names without sacrificing the meaning...
Like
[[outputs.quix]] | |
workspace = "your_workspace" | |
auth_token = "your_auth_token" | |
topic = "telegraf_metrics" | |
api_url = "https://portal-api.platform.quix.io" | |
data_format = "json" | |
timestamp_units = "1s" | |
# Sending metrics to a Quix data processing pipeline | |
[[outputs.quix]] | |
## Endpoint accepting the data | |
# url = "https://portal-api.platform.quix.io" | |
## Workspace and topics to send the metrics to | |
workspace = "your_workspace" | |
topic = "telegraf_metrics" | |
## Authentication token created in Quix | |
token = "your_auth_token" |
q.Log.Errorf("Error sending message to Kafka: %v", err) | ||
} | ||
} | ||
q.Log.Debugf("Metrics sent to Quix.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q.Log.Debugf("Metrics sent to Quix.") |
// Close shuts down the Kafka producer | ||
func (q *Quix) Close() error { | ||
if q.producer != nil { | ||
q.Log.Infof("Closing Quix producer connection.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q.Log.Infof("Closing Quix producer connection.") |
) | ||
|
||
// XDGSCRAMClient wraps the SCRAM client for SCRAM-SHA-256 authentication | ||
type XDGSCRAMClient struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to export this struct?
// Define SHA256 and SHA512 hash generators | ||
var SHA256 scram.HashGeneratorFcn = scram.SHA256 | ||
var SHA512 scram.HashGeneratorFcn = scram.SHA512 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? It's not used anywhere...
// scram_client.go | ||
package quix | ||
|
||
import ( | ||
"github.com/xdg-go/scram" | ||
) | ||
|
||
// XDGSCRAMClient wraps the SCRAM client for SCRAM-SHA-256 authentication | ||
type XDGSCRAMClient struct { | ||
*scram.Client | ||
*scram.ClientConversation | ||
HashGeneratorFcn scram.HashGeneratorFcn | ||
} | ||
|
||
// Begin initializes the SCRAM client with username and password | ||
func (x *XDGSCRAMClient) Begin(userName, password, authzID string) error { | ||
client, err := x.HashGeneratorFcn.NewClient(userName, password, authzID) | ||
if err != nil { | ||
return err | ||
} | ||
x.Client = client | ||
x.ClientConversation = client.NewConversation() | ||
return nil | ||
} | ||
|
||
// Step processes the server's challenge and returns the client's response | ||
func (x *XDGSCRAMClient) Step(challenge string) (string, error) { | ||
return x.ClientConversation.Step(challenge) | ||
} | ||
|
||
// Done returns true if the SCRAM conversation is complete | ||
func (x *XDGSCRAMClient) Done() bool { | ||
return x.ClientConversation.Done() | ||
} | ||
|
||
// Define SHA256 and SHA512 hash generators | ||
var SHA256 scram.HashGeneratorFcn = scram.SHA256 | ||
var SHA512 scram.HashGeneratorFcn = scram.SHA512 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole file is a blunt copy of plugins/common/kafka/scram_client.go
. Why do we need this?
First implementation - no defaults
Summary
Checklist
Related issues
resolves #
!signed-cla