Skip to content

Commit de146ed

Browse files
committed
add readme for addons folder
1 parent a1f1eda commit de146ed

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

addons/README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# 🧩 FlowTracker Addons
2+
3+
This directory contains official extensions for the **[FlowTracker](https://github.com/spdeepak/flowtracker)** library.
4+
5+
### Why are these separate?
6+
To keep the core `flowtracker` library lightweight and dependency-free.
7+
* **Core Library:** Zero heavy dependencies. Just standard Go.
8+
* **Addons:** May require heavy SDKs (Kafka, OpenTelemetry).
9+
10+
By using a **Multi-Module** architecture, you only download the dependencies for the specific exporters you actually use.
11+
12+
---
13+
14+
## 📦 Available Addons
15+
16+
| Addon | Description | Dependencies |
17+
|:-------------------------------------------------| :--- | :--- |
18+
| **[Kafka Exporter](./confluent-kafka)** | Pushes trace data to an Apache Kafka topic. | `confluent-kafka-go` |
19+
| **[OpenTelemetry Bridge](./otel)** | Sends traces to Jaeger, Grafana Tempo, Datadog, etc. | `go.opentelemetry.io` |
20+
21+
---
22+
23+
## 🚀 Installation
24+
25+
Because these are separate Go modules, you must `go get` the specific addon you need.
26+
27+
**Example: Installing the Kafka Exporter**
28+
```bash
29+
# 1. Get the core
30+
go get github.com/spdeepak/flowtracker
31+
32+
# 2. Get the addon
33+
go get github.com/spdeepak/flowtracker/kafka-exporter
34+
```
35+
36+
---
37+
38+
## 🛠 General Usage
39+
40+
All addons implement the standard `Exporter` interface defined in the core library. Usage is consistent across all extensions:
41+
42+
```go
43+
package main
44+
45+
import (
46+
"github.com/spdeepak/flowtracker"
47+
"github.com/spdeepak/flowtracker/kafka-exporter" // Import the addon
48+
)
49+
50+
func main() {
51+
// 1. Initialize the Addon
52+
// (Refer to the specific addon's README for config details)
53+
myExporter, _ := kafkaexporter.New(...)
54+
55+
// 2. Inject into Middleware
56+
mw := flowtracker.NewMiddleware(
57+
flowtracker.WithExporter(myExporter),
58+
)
59+
60+
// 3. Run Server
61+
http.ListenAndServe(":8080", mw(mux))
62+
}
63+
```
64+
65+
---
66+
67+
## 👩‍💻 Contributing a New Addon
68+
69+
We welcome contributions! If you want to create a new exporter (e.g., for AWS S3, Elasticsearch, or Slack), follow these steps:
70+
71+
1. **Create a directory:**
72+
```bash
73+
mkdir addons/my-new-exporter
74+
cd addons/my-new-exporter
75+
```
76+
77+
2. **Initialize the Module:**
78+
*Important: The module name must include the full path.*
79+
```bash
80+
go mod init github.com/spdeepak/flowtracker/my-new-exporter
81+
```
82+
83+
3. **Develop Locally:**
84+
In your `go.mod`, use a replace directive to point to the local core library during development:
85+
```go
86+
require github.com/spdeepak/flowtracker v0.0.0
87+
replace github.com/spdeepak/flowtracker => ../../flowtracker
88+
```
89+
90+
4. **Implement the Interface:**
91+
Your struct must satisfy:
92+
```go
93+
type Exporter interface {
94+
Export(trace *flowtracker.Trace)
95+
}
96+
```
97+
98+
5. **Release:**
99+
When ready to merge, remove the `replace` directive. Release tags for addons must follow the pattern:
100+
`addons/my-new-exporter/v0.0.1`

0 commit comments

Comments
 (0)