Documentation ¶
Index ¶
- Variables
- func AsGRPCError(e error) error
- func AsJson(e error) string
- func BytesToTraceID(traceID []byte) string
- func GetSupportedContentEncodings() []string
- func GetSupportedContentTypes() []string
- func IsContentTypeSupported(contentType string) bool
- type Batch
- type Event
- type OTLPError
- type RequestInfo
- type TranslateOTLPRequestResult
- func TranslateLogsRequest(request *collectorLogs.ExportLogsServiceRequest, ri RequestInfo) (*TranslateOTLPRequestResult, error)
- func TranslateLogsRequestFromReader(body io.ReadCloser, ri RequestInfo) (*TranslateOTLPRequestResult, error)
- func TranslateTraceRequest(request *collectorTrace.ExportTraceServiceRequest, ri RequestInfo) (*TranslateOTLPRequestResult, error)
- func TranslateTraceRequestFromReader(body io.ReadCloser, ri RequestInfo) (*TranslateOTLPRequestResult, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidContentType = OTLPError{"unsupported content-type, valid types are: " + strings.Join(GetSupportedContentTypes(), ", "), http.StatusUnsupportedMediaType, codes.Unimplemented} ErrFailedParseBody = OTLPError{"failed to parse OTLP request body", http.StatusBadRequest, codes.Internal} ErrMissingAPIKeyHeader = OTLPError{"missing 'x-honeycomb-team' header", http.StatusUnauthorized, codes.Unauthenticated} ErrMissingDatasetHeader = OTLPError{"missing 'x-honeycomb-dataset' header", http.StatusUnauthorized, codes.Unauthenticated} )
Functions ¶
func AsGRPCError ¶
func BytesToTraceID ¶
BytesToTraceID returns an ID suitable for use for spans and traces. Before encoding the bytes as a hex string, we want to handle cases where we are given 128-bit IDs with zero padding, e.g. 0000000000000000f798a1e7f33c8af6. There are many ways to achieve this, but careful benchmarking and testing showed the below as the most performant, avoiding memory allocations and the use of flexible but expensive library functions. As this is hot code, it seemed worthwhile to do it this way.
func GetSupportedContentEncodings ¶
func GetSupportedContentEncodings() []string
List of HTTP Content Encodings supported for OTLP ingest.
func GetSupportedContentTypes ¶
func GetSupportedContentTypes() []string
List of HTTP Content Types supported for OTLP ingest.
func IsContentTypeSupported ¶
Check whether we support a given HTTP Content Type for OTLP.
Types ¶
type Batch ¶
Batch represents Honeycomb events grouped by their target dataset SizeBytes is the total byte size of the OTLP structure that represents this batch
type Event ¶
type Event struct { Attributes map[string]interface{} Timestamp time.Time SampleRate int32 ResourceSpan *v1.ResourceSpans }
Event represents a single Honeycomb event
type RequestInfo ¶
type RequestInfo struct { ApiKey string Dataset string UserAgent string ContentType string ContentEncoding string GRPCAcceptEncoding string }
RequestInfo represents information parsed from either HTTP headers or gRPC metadata
func GetRequestInfoFromGrpcMetadata ¶
func GetRequestInfoFromGrpcMetadata(ctx context.Context) RequestInfo
GetRequestInfoFromGrpcMetadata parses relevant gRPC metadata from an incoming request context
func GetRequestInfoFromHttpHeaders ¶
func GetRequestInfoFromHttpHeaders(header http.Header) RequestInfo
GetRequestInfoFromHttpHeaders parses relevant incoming HTTP headers
func (*RequestInfo) ValidateLogsHeaders ¶
func (ri *RequestInfo) ValidateLogsHeaders() error
ValidateLogsHeaders validates required headers/metadata for a logs OTLP request
func (*RequestInfo) ValidateMetricsHeaders ¶
func (ri *RequestInfo) ValidateMetricsHeaders() error
ValidateMetricsHeaders validates required headers/metadata for a metric OTLP request
func (*RequestInfo) ValidateTracesHeaders ¶
func (ri *RequestInfo) ValidateTracesHeaders() error
ValidateTracesHeaders validates required headers/metadata for a trace OTLP request
type TranslateOTLPRequestResult ¶
TranslateOTLPRequestResult represents an OTLP request translated into Honeycomb-friendly structure RequestSize is total byte size of the entire OTLP request Batches represent events grouped by their target dataset
func TranslateLogsRequest ¶
func TranslateLogsRequest(request *collectorLogs.ExportLogsServiceRequest, ri RequestInfo) (*TranslateOTLPRequestResult, error)
TranslateLogsRequest translates an OTLP proto log request into Honeycomb-friendly structure RequestInfo is the parsed information from the gRPC metadata
func TranslateLogsRequestFromReader ¶
func TranslateLogsRequestFromReader(body io.ReadCloser, ri RequestInfo) (*TranslateOTLPRequestResult, error)
TranslateLogsRequestFromReader translates an OTLP log request into Honeycomb-friendly structure from a reader (eg HTTP body) RequestInfo is the parsed information from the gRPC metadata
func TranslateTraceRequest ¶
func TranslateTraceRequest(request *collectorTrace.ExportTraceServiceRequest, ri RequestInfo) (*TranslateOTLPRequestResult, error)
TranslateTraceRequest translates an OTLP/gRPC request into Honeycomb-friendly structure RequestInfo is the parsed information from the gRPC metadata
func TranslateTraceRequestFromReader ¶
func TranslateTraceRequestFromReader(body io.ReadCloser, ri RequestInfo) (*TranslateOTLPRequestResult, error)
TranslateTraceRequestFromReader translates an OTLP/HTTP request into Honeycomb-friendly structure RequestInfo is the parsed information from the HTTP headers