slackreceiver

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: 13 Imported by: 0

README

Slack Receiver

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

Prerequisites

This collector receiver works as a Slack application, so you need to prepare the token in advance. Especially, because this only works in the socket mode, you need both a bot token and an app token.

Configuration

The following settings are required:

  • bot_token: Slack Bot token for a workspace.
  • app_token: Slack App token for a workspace.
  • 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 Slack 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:
  slack:
    bot_token: <YOUR_BOT_TOKEN>
    app_token: <YOUR_APP_TOKEN>
    server_wide: false
    buffer_interval: "1m"
    channels:
      - "general"
      - "random"

Documentation

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 Slack receiver.

Types

type Config

type Config struct {
	// BotToken is the Slack bot token.
	BotToken string `mapstructure:"bot_token"`

	// AppToken is the Slack bot token.
	AppToken string `mapstructure:"app_token"`

	// BufferInterval is the interval period to buffer messages from Slack.
	// 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 workspace.
	// 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