Documentation ¶
Index ¶
- Constants
- Variables
- func AsGRPCError(e error) error
- func AsJson(e error) string
- func BytesToTraceID(traceID []byte) string
- func DetermineClassification(args ...[]*commonpb.KeyValue) map[string]string
- func GetSupportedContentEncodings() []string
- func GetSupportedContentTypes() []string
- func IsContentTypeSupported(contentType string) bool
- func NormalizeClassification(m map[string]string, args ...[]*commonpb.KeyValue) map[string]string
- type Batch
- type Event
- type OTLPError
- type RequestInfo
- type SpanEvent
- type TranslateOTLPRequestResult
- type TranslateTraceRequestResult
Constants ¶
const ( TransactionType = "transaction.type" TransactionCategory = "transaction.category" TransactionSubCategory = "transaction.sub_category" Language = "language" )
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-opsramp-team' header", http.StatusUnauthorized, codes.Unauthenticated} ErrMissingDatasetHeader = OTLPError{"missing 'x-opsramp-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 DetermineClassification ¶
DetermineClassification returns a map of labels classifying the type of the span based on the predefined attributes in the span
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 SpanEvents []SpanEvent }
Event represents a single Honeycomb event
type RequestInfo ¶
type RequestInfo struct { Dataset string ContentType string ContentEncoding string GRPCAcceptEncoding string ApiToken string ApiTenantId 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
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 TranslateTraceRequest ¶
func TranslateTraceRequest(request *coltracepb.ExportTraceServiceRequest, ri RequestInfo, additionalResAttr map[string]string, sendEvents bool) (*TranslateOTLPRequestResult, error)
TranslateTraceRequest translates an OTLP/gRPC request into OpsRamp-friendly structure RequestInfo is the parsed information from the gRPC metadata
func TranslateTraceRequestFromReader ¶
func TranslateTraceRequestFromReader(body io.ReadCloser, ri RequestInfo, additionalAttr map[string]string, sendEvents bool) (*TranslateOTLPRequestResult, error)
TranslateTraceRequestFromReader translates an OTLP/HTTP request into Honeycomb-friendly structure RequestInfo is the parsed information from the HTTP headers
type TranslateTraceRequestResult ¶
TranslateTraceRequestResult represents an OTLP trace request translated into Opsramp-friendly structure RequestSize is total byte size of the entire OTLP request Batches represent events grouped by their target dataset