oteldisgo

package module
v0.0.0-...-d7e7d83 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Go Reference Go Report Go Version License Otel DisGo Version DisGo Discord

OtelDisGo

OtelDisGo is a DisGo handler middleware for OpenTelemetry. It provides a simple way to trace your DisGo commands.

Summary

  1. Getting Started
  2. Documentation
  3. Troubleshooting
  4. Contributing
  5. License

Getting Started

Installing
$ go get github.com/disgoorg/oteldisgo
Usage

Check https://opentelemetry.io/docs/languages/go/getting-started/ for more information on how to set up OpenTelemetry.

package main

import (
	"github.com/disgoorg/disgo/handler"
	"github.com/disgoorg/oteldisgo"
)

func main() {
	r := handler.New()
	r.Use(oteldisgo.Middleware("example"))
	// handle commands as usual here
}

OTEL Tracing

OtelDisGo provides the following spans attributes:

  1. For All:
    • interaction.type - The type of the interaction
    • interaction.id - The id of the interaction
    • interaction.application.id - The id of the application
    • interaction.user.id - The id of the user
    • interaction.channel.id - The id of the channel
    • interaction.guild.id - The id of the guild (if applicable)
    • interaction.createdat - The time the interaction was created
  2. Application Command Interaction
    • interaction.command.id - The id of the command
    • interaction.command.name - The name of the command
    • interaction.command.guild.id - The guild id of the command (if applicable)
    1. Slash Command Interaction
      • interaction.command.subcommand - The subcommand of the command
      • interaction.command.subcommandgroup - The subcommand group of the command
      • interaction.command.path - The full path of the command
    2. User Command Interaction
      • interaction.command.user.id - The id of the user who the command was used on
    3. Message Command Interaction
      • interaction.command.message.id - The id of the message the command was used on
  3. AutoComplete Interaction
    • interaction.command.id - The id of the command
    • interaction.command.name - The name of the command
    • interaction.command.subcommand - The subcommand of the command
    • interaction.command.subcommandgroup - The subcommand group of the command
    • interaction.command.path - The full path of the command
    • interaction.command.guild.id - The guild id of the command (if applicable)
  4. Component Interaction
    • interaction.component.type - The type of the component
    • interaction.component.customid - The custom id of the component
  5. Modal Interaction
    • interaction.modal.customid - The custom id of the modal
OTEL Metrics

OtelDisGo records the following metrics:

  1. Instruments:
    • discord.interaction.duration (Float64Histogram, unit s) - Duration of Discord interaction handling
    • discord.interaction.count (Int64Counter, unit {interaction}) - Total number of Discord interactions handled
    • discord.interaction.active (Int64UpDownCounter, unit {interaction}) - Number of currently active Discord interactions being handled
  2. Metric Attributes:
    • interaction.type - The type of the interaction (on all metrics)
    • interaction.name - The formatted span name, using WithSpanNameFormatter if configured (on duration and count)
    • interaction.status - "ok" or "error" (on duration and count)

Documentation

Documentation can be found under

  • Go Reference
  • OpenTelemetry Documentation

Troubleshooting

For help feel free to open an issue or reach out on Discord

Contributing

Contributions are welcomed but for bigger changes we recommend first reaching out via Discord or create an issue to discuss your problems, intentions and ideas.

License

Distributed under the License. See LICENSE for more information.

Supported by Jetbrains

Jetbrain Open Source Community Support

Jump to

Keyboard shortcuts

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