Skip to content

Commit

Permalink
Update documentation for the OTLP exporter (#1242)
Browse files Browse the repository at this point in the history
* Update documentation for the OTLP exporter

Update package documentation to reflect the contents of the package.

Fix lint issues by adding documentation for all exported types.

Update file comment location in otlp.go so golint does not interpret it
as package documentation.

* Apply suggestions from code review

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
  • Loading branch information
MrAlias and Aneurysm9 committed Oct 12, 2020
1 parent f60f51d commit 7ecc555
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion exporters/otlp/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package otlp contains an OpenTelemetry tracing exporter for OpenTelemetry Collector.
// Package otlp contains an exporter for the OpenTelemetry protocol buffers.
package otlp // import "go.opentelemetry.io/otel/exporters/otlp"
12 changes: 11 additions & 1 deletion exporters/otlp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ import (
)

const (
// DefaultCollectorPort is the port the Exporter will attempt connect to
// if no collector port is provided.
DefaultCollectorPort uint16 = 55680
// DefaultCollectorHost is the host address the Exporter will attempt
// connect to if no collector address is provided.
DefaultCollectorHost string = "localhost"
DefaultNumWorkers uint = 1
// DefaultNumWorkers is the number of goroutines the Exporter will use when
// processing telemetry.
DefaultNumWorkers uint = 1

// DefaultGRPCServiceConfig is the gRPC service config used if none is
// provided by the user.
//
// For more info on gRPC service configs:
// https://github.com/grpc/proposal/blob/master/A6-client-retries.md
//
Expand Down Expand Up @@ -61,6 +70,7 @@ const (
}`
)

// ExporterOption are setting options passed to an Exporter on creation.
type ExporterOption func(*config)

type config struct {
Expand Down
10 changes: 9 additions & 1 deletion exporters/otlp/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// code in this package is mostly copied from contrib.go.opencensus.io/exporter/ocagent/connection.go
package otlp

// This code was based on
// contrib.go.opencensus.io/exporter/ocagent/connection.go

import (
"context"
"errors"
Expand All @@ -35,6 +37,9 @@ import (
tracesdk "go.opentelemetry.io/otel/sdk/export/trace"
)

// Exporter is an OpenTelemetry exporter. It exports both traces and metrics
// from OpenTelemetry instrumented to code using OpenTelemetry protocol
// buffers to a configurable receiver.
type Exporter struct {
// mu protects the non-atomic and non-channel variables
mu sync.RWMutex
Expand Down Expand Up @@ -280,10 +285,13 @@ func (e *Exporter) Export(parent context.Context, cps metricsdk.CheckpointSet) e
return nil
}

// ExportKindFor reports back to the OpenTelemetry SDK sending this Exporter
// metric telemetry that it needs to be provided in a pass-through format.
func (e *Exporter) ExportKindFor(*metric.Descriptor, aggregation.Kind) metricsdk.ExportKind {
return metricsdk.PassThroughExporter
}

// ExportSpans exports a batch of SpanData.
func (e *Exporter) ExportSpans(ctx context.Context, sds []*tracesdk.SpanData) error {
return e.uploadTraces(ctx, sds)
}
Expand Down

0 comments on commit 7ecc555

Please sign in to comment.