Documentation ¶
Overview ¶
Package kafkaexporter exports trace data to Kafka.
Index ¶
- func ConfigureAuthentication(config Authentication, saramaConfig *sarama.Config) error
- func NewFactory(options ...FactoryOption) component.ExporterFactory
- type AWSMSKConfig
- type Authentication
- type Config
- type FactoryOption
- type KerberosConfig
- type LogsMarshaler
- type Metadata
- type MetadataRetry
- type MetricsMarshaler
- type PlainTextConfig
- type Producer
- type SASLConfig
- type TracesMarshaler
- type XDGSCRAMClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureAuthentication ¶
func ConfigureAuthentication(config Authentication, saramaConfig *sarama.Config) error
ConfigureAuthentication configures authentication in sarama.Config.
func NewFactory ¶
func NewFactory(options ...FactoryOption) component.ExporterFactory
NewFactory creates Kafka exporter factory.
Types ¶
type AWSMSKConfig ¶
type AWSMSKConfig struct { // Region is the AWS region the MSK cluster is based in Region string `mapstructure:"region"` // BrokerAddr is the client is connecting to in order to perform the auth required BrokerAddr string `mapstructure:"broker_addr"` }
AWSMSKConfig defines the additional SASL authentication measures needed to use AWS_MSK_IAM mechanism
type Authentication ¶
type Authentication struct { PlainText *PlainTextConfig `mapstructure:"plain_text"` SASL *SASLConfig `mapstructure:"sasl"` TLS *configtls.TLSClientSetting `mapstructure:"tls"` Kerberos *KerberosConfig `mapstructure:"kerberos"` }
Authentication defines authentication.
type Config ¶
type Config struct { config.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct exporterhelper.TimeoutSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct. exporterhelper.QueueSettings `mapstructure:"sending_queue"` exporterhelper.RetrySettings `mapstructure:"retry_on_failure"` // The list of kafka brokers (default localhost:9092) Brokers []string `mapstructure:"brokers"` // Kafka protocol version ProtocolVersion string `mapstructure:"protocol_version"` // The name of the kafka topic to export to (default otlp_spans for traces, otlp_metrics for metrics) Topic string `mapstructure:"topic"` // Encoding of messages (default "otlp_proto") Encoding string `mapstructure:"encoding"` // Metadata is the namespace for metadata management properties used by the // Client, and shared by the Producer/Consumer. Metadata Metadata `mapstructure:"metadata"` // Producer is the namespaces for producer properties used only by the Producer Producer Producer `mapstructure:"producer"` // Authentication defines used authentication mechanism. Authentication Authentication `mapstructure:"auth"` }
Config defines configuration for Kafka exporter.
type FactoryOption ¶
type FactoryOption func(factory *kafkaExporterFactory)
FactoryOption applies changes to kafkaExporterFactory.
func WithTracesMarshalers ¶
func WithTracesMarshalers(tracesMarshalers ...TracesMarshaler) FactoryOption
WithTracesMarshalers adds tracesMarshalers.
type KerberosConfig ¶
type KerberosConfig struct { ServiceName string `mapstructure:"service_name"` Realm string `mapstructure:"realm"` UseKeyTab bool `mapstructure:"use_keytab"` Username string `mapstructure:"username"` Password string `mapstructure:"password" json:"-"` ConfigPath string `mapstructure:"config_file"` KeyTabPath string `mapstructure:"keytab_file"` }
KerberosConfig defines kereros configuration.
type LogsMarshaler ¶
type LogsMarshaler interface { // Marshal serializes logs into sarama's ProducerMessages Marshal(logs plog.Logs, topic string) ([]*sarama.ProducerMessage, error) // Encoding returns encoding name Encoding() string }
LogsMarshaler marshals logs into Message array
type Metadata ¶
type Metadata struct { // Whether to maintain a full set of metadata for all topics, or just // the minimal set that has been necessary so far. The full set is simpler // and usually more convenient, but can take up a substantial amount of // memory if you have many topics and partitions. Defaults to true. Full bool `mapstructure:"full"` // Retry configuration for metadata. // This configuration is useful to avoid race conditions when broker // is starting at the same time as collector. Retry MetadataRetry `mapstructure:"retry"` }
Metadata defines configuration for retrieving metadata from the broker.
type MetadataRetry ¶
type MetadataRetry struct { // The total number of times to retry a metadata request when the // cluster is in the middle of a leader election or at startup (default 3). Max int `mapstructure:"max"` // How long to wait for leader election to occur before retrying // (default 250ms). Similar to the JVM's `retry.backoff.ms`. Backoff time.Duration `mapstructure:"backoff"` }
MetadataRetry defines retry configuration for Metadata.
type MetricsMarshaler ¶
type MetricsMarshaler interface { // Marshal serializes metrics into sarama's ProducerMessages Marshal(metrics pmetric.Metrics, topic string) ([]*sarama.ProducerMessage, error) // Encoding returns encoding name Encoding() string }
MetricsMarshaler marshals metrics into Message array
type PlainTextConfig ¶
type PlainTextConfig struct { Username string `mapstructure:"username"` Password string `mapstructure:"password"` }
PlainTextConfig defines plaintext authentication.
type Producer ¶
type Producer struct { // Maximum message bytes the producer will accept to produce. MaxMessageBytes int `mapstructure:"max_message_bytes"` // RequiredAcks Number of acknowledgements required to assume that a message has been sent. // https://pkg.go.dev/github.com/Shopify/sarama@v1.30.0#RequiredAcks // The options are: // 0 -> NoResponse. doesn't send any response // 1 -> WaitForLocal. waits for only the local commit to succeed before responding ( default ) // -1 -> WaitForAll. waits for all in-sync replicas to commit before responding. RequiredAcks sarama.RequiredAcks `mapstructure:"required_acks"` // Compression Codec used to produce messages // https://pkg.go.dev/github.com/Shopify/sarama@v1.30.0#CompressionCodec // The options are: 'none', 'gzip', 'snappy', 'lz4', and 'zstd' Compression string `mapstructure:"compression"` // The maximum number of messages the producer will send in a single // broker request. Defaults to 0 for unlimited. Similar to // `queue.buffering.max.messages` in the JVM producer. FlushMaxMessages int `mapstructure:"flush_max_messages"` }
Producer defines configuration for producer
type SASLConfig ¶
type SASLConfig struct { // Username to be used on authentication Username string `mapstructure:"username"` // Password to be used on authentication Password string `mapstructure:"password"` // SASL Mechanism to be used, possible values are: (PLAIN, AWS_MSK_IAM, SCRAM-SHA-256 or SCRAM-SHA-512). Mechanism string `mapstructure:"mechanism"` AWSMSK AWSMSKConfig `mapstructure:"aws_msk"` }
SASLConfig defines the configuration for the SASL authentication.
type TracesMarshaler ¶
type TracesMarshaler interface { // Marshal serializes spans into sarama's ProducerMessages Marshal(traces ptrace.Traces, topic string) ([]*sarama.ProducerMessage, error) // Encoding returns encoding name Encoding() string }
TracesMarshaler marshals traces into Message array.
type XDGSCRAMClient ¶
type XDGSCRAMClient struct { *scram.Client *scram.ClientConversation scram.HashGeneratorFcn }
XDGSCRAMClient uses xdg-go scram to authentication conversation
func (*XDGSCRAMClient) Begin ¶
func (x *XDGSCRAMClient) Begin(userName, password, authzID string) (err error)
Begin starts the XDGSCRAMClient conversation.
func (*XDGSCRAMClient) Done ¶
func (x *XDGSCRAMClient) Done() bool
Done returns true if the conversation is completed or has errored.
func (*XDGSCRAMClient) Step ¶
func (x *XDGSCRAMClient) Step(challenge string) (response string, err error)
Step takes a string provided from a server (or just an empty string for the very first conversation step) and attempts to move the authentication conversation forward. It returns a string to be sent to the server or an error if the server message is invalid. Calling Step after a conversation completes is also an error.