Categorygithub.com/Syn3rman/fluentforward
modulepackage
0.1.12
Repository: https://github.com/syn3rman/fluentforward.git
Documentation: pkg.go.dev

# README

Fluentbit exporter

This repo contains the fluentbit exporter for opentelemetry. It allows users to export the telemetry data collected by the various SDK's using a fluentbit/fluentd instance, using the fluentforward protocol.

Provided that you have a fluent instance running on the node, you can export spans to the collector (with the fluentforwardreceiver enabed) or any other fluent instance that is listening using the fluentforward protocol by installing this exporter in your application by simply using the InstallNewPipeline() method as shown:

hostport := "localhost:24224"
serviveName := "fluentforward"
retryTimeout := 10*time.Second
err := fluentforward.InstallNewPipeline(hostport, serviceName, retryTimeout)

While initializing the exporter, we can specify the timeout parameter, which will reconnect to the remote instance every timeout duration, which decreases the chances of writes failing due to connection issues.

If a write fails, the exporter will attempt to reconnect to the fluent instance and will retry the write again before returning.

The data mapping can be found below:

For a span:

Otel-go representationOtel typeFluentbit representationFluentbit type
TraceIDtrace.IDTraceIDstring
SpanIDtrace.SpanIDSpanIDstring
ParentSpanIDtrace.SpanIDParentSpanIDstring
NamestringNamestring
SpanKindtrace.SpanKindSpanKindint
StartTimetime.TimeStartTimeint64
EndTimetime.TimeEndTimeint64
Attributes[]label.KeyValueAttrsmap[label.Key]interface{}
DroppedAttributesCountintDroppedAttributeCountint
MessageEventstrace.EventMessageEvents[]event
DroppedEventsCountintDroppedEventsCountint
Links[]trace.LinkLinks[]link
DroppedLinksCountintDroppedLinksCountint
StatusCodecodes.CodeStatusCodestring
StatusMessagestringStatusMessagestring
Resource*resource.ResourceResourcestring
InstrumentationLibraryInstrumentation.LibraryInstrumentationLibraryName, Versionstring

Note: The field TraceState is missing in the go implementation

The mappings for an event and a link are as shown:

Link

Otel-go representationOtel typeFluentbit representationFluentbit type
TraceIDtrace.IDTraceIDstring
SpanIDtrace.SpanIDSpanIDstring
Attributes[]label.KeyValueAttrsmap[label.Key]interface{}

Event

Otel-go representationOtel typeFluentbit representationFluentbit type
NamestringNamestring
Timetime.TimeTimeint64
Attributes[]label.KeyValueAttrsmap[label.Key]interface{}

# Functions

InstallNewPipeline instantiates a NewExportPipeline with the recommended configuration and registers it globally.
NewExportPipeline sets up a complete export pipeline with the recommended setup for trace provider.
NewRawExporter creates a new exporter.
WithLogger configures the exporter to use the passed logger.
WithSDK sets the SDK config for the exporter pipeline.

# Structs

An event is a time-stamped annotation of the span that has user supplied text description and key-value pairs.
Exporter implements the SpanExporter interface that allows us to export span data.
A link contains references from this span to a span in the same or different trace.
SpanData contains all the properties of the span.

# Type aliases

Option defines a function that configures the exporter.