discordreceiver

package module
v0.0.0-...-3692aed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

README

Discord Receiver

The Discord receiver is designed to retrieve Discord statistical data from a single Discord server: it generates metrics from the channel messages in the server.

Prerequisites

This collector receiver works as a Discord application, so you need to prepare the token in advance.

Configuration

The following settings are required:

  • token: Discord API token for a server.
  • server_wide (default = false): If it is true, the receiver collects statistics from all channels in the server. If it is false, the receiver collects statistics per channel.
  • buffer_interval (default = "30s"): Interval period to buffer Discord messages to collect metrics. Valid units are the ones supported by time.ParseDuration.

The following settings are optional:

  • channels (dafault = ""): The list of channels to collect statistics from. If it is blank, all channels are collected. This setting is ignored if server_wide is true.

Example:

receivers:
  discord:
    token: <YOUR_APPLICATION_TOKEN>
    server_wide: false
    buffer_interval: "1m"
    channels:
      - "general"
      - "random"

Documentation

Overview

Package discordreceiver implements a receiver that can be used by the Opentelemetry collector to receive and make statistics of Discord messages

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() receiver.Factory

NewFactory returns a new factory for the Discord receiver.

Types

type Config

type Config struct {
	// Token is the Discord bot token.
	Token string `mapstructure:"token"`

	// BufferInterval is the interval period to buffer messages from Discord.
	// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m" and "h", which are
	// supported by time.ParseDuration().
	// Default is "30s".
	BufferInterval string `mapstructure:"buffer_interval"`

	// ServerWide is an optional setting to collect statistics from all channels in the server.
	// If it is false, the receiver collects statistics per channel.
	// If it is true, the receiver ignores the Channels setting.
	// Default is false.
	ServerWide bool `mapstructure:"server_wide,omitempty"`

	// Channels is an optional setting to collect statistics from specific channels.
	// If it is empty, the receiver collects statistics from all channels.
	// The ServerWide setting is true, receiver ignores this setting.
	Channels []string `mapstructure:"channels,omitempty"`

	// MetricsBuilderConfig is the configuration for the metrics builder.
	MetricsBuilderConfig metadata.MetricsBuilderConfig
}

func (Config) Validate

func (c Config) Validate() error

Validate checks if the receiver configuration is valid.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL