https://github.com/disgoorg/oteldisgo
OpenTelemetry DisGo handler instrumentation
https://github.com/disgoorg/oteldisgo
discord disgo golang otel
Last synced: 26 days ago
JSON representation
OpenTelemetry DisGo handler instrumentation
- Host: GitHub
- URL: https://github.com/disgoorg/oteldisgo
- Owner: disgoorg
- License: apache-2.0
- Created: 2024-02-18T14:56:54.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-05T22:14:44.000Z (over 1 year ago)
- Last Synced: 2025-01-18T11:28:24.109Z (about 1 year ago)
- Topics: discord, disgo, golang, otel
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/github.com/disgoorg/oteldisgo)
[](https://goreportcard.com/report/github.com/disgoorg/oteldisgo)
[](https://golang.org/doc/devel/release.html)
[](https://github.com/disgoorg/oteldisgo/blob/master/LICENSE)
[](https://github.com/disgoorg/oteldisgo/releases/latest)
[](https://discord.gg/TewhTfDpvW)
# OtelDisGo
OtelDisGo is a [DisGo](https://github.com/disgoorg/disgo) handler middleware for [OpenTelemetry](https://opentelemetry.io/). It provides a simple way to trace your DisGo commands.
## Summary
1. [Getting Started](#getting-started)
2. [Documentation](#documentation)
3. [Troubleshooting](#troubleshooting)
4. [Contributing](#contributing)
5. [License](#license)
## Getting Started
### Installing
```sh
$ 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.
```go
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.tye` - 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.component.customid` - The custom id of the modal
## Documentation
Documentation can be found under
* [](https://pkg.go.dev/github.com/disgoorg/oteldisgo)
* [](https://opentelemetry.io/docs/languages/go/)
## Troubleshooting
For help feel free to open an issue or reach out on [Discord](https://discord.gg/TewhTfDpvW)
## Contributing
Contributions are welcomed but for bigger changes we recommend first reaching out via [Discord](https://discord.gg/TewhTfDpvW) or create an issue to discuss your problems, intentions and ideas.
## License
Distributed under the [](LICENSE). See LICENSE for more information.
## Supported by Jetbrains