converter

package
v0.0.0-...-43db36b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagMessage                = "message"
	TagSpanKind               = "span.kind"
	TagStatusCode             = "status.code"
	TagStatusMsg              = "status.message"
	TagError                  = "error"
	TagHTTPStatusCode         = "http.status_code"
	TagHTTPStatusMsg          = "http.status_message"
	TagZipkinCensusCode       = "census.status_code"
	TagZipkinCensusMsg        = "census.status_description"
	TagZipkinOpenCensusMsg    = "opencensus.status_description"
	TagW3CTraceState          = "w3c.tracestate"
	TagServiceNameSource      = "otlp.service.name.source"
	TagInstrumentationName    = "otlp.instrumentation.library.name"
	TagInstrumentationVersion = "otlp.instrumentation.library.version"

	ResourceNoServiceName = "OTLPResourceNoServiceName"

	OCAttributeProcessStartTime        = "opencensus.starttime"
	OCAttributeProcessID               = "opencensus.pid"
	OCAttributeExporterVersion         = "opencensus.exporterversion"
	OCAttributeResourceType            = "opencensus.resourcetype"
	OCAttributeSameProcessAsParentSpan = "opencensus.same_process_as_parent_span"
	OCTimeEventMessageEventType        = "opencensus.timeevent.messageevent.type"
	OCTimeEventMessageEventID          = "opencensus.timeevent.messageevent.id"
	OCTimeEventMessageEventUSize       = "opencensus.timeevent.messageevent.usize"
	OCTimeEventMessageEventCSize       = "opencensus.timeevent.messageevent.csize"
)
View Source
const (
	// ParentService The log item key of parent service name
	ParentService = "parent_service"
	// ChildService the field name of child service
	ChildService = "child_service"
	// ServiceName the field name of service
	ServiceName = "service"
	// OperationName the field name of operation name
	OperationName = "name"
	// SpanKind  the field name of span kind
	SpanKind = "kind"
	// TraceID the field name of trace id
	TraceID = "traceID"
	// TraceIDField
	TraceIDField = "traceid"
	// SpanID the field name of span id
	SpanID = "spanID"
	// SpanIDField
	SpanIDField = "spanID"
	// ParentSpanID the field name of parent span id
	ParentSpanID = "parentSpanID"
	// StartTime the field name of start time
	StartTime = "start"
	// Duration the field name of duration
	Duration = "duration"
	// Attribute the field name of span tags
	Attribute = "attribute"
	// Resource the field name of span process tag
	Resource = "resource"
	// Logs the field name of span log
	Logs = "logs"
	// Links the field name of span reference
	Links = "links"
	// StatusMessage the field name of warning message of span
	StatusMessage = "statusMessage"
	//StatusMessageField
	StatusMessageField = "statusmessage"
	// Flags the field name of flags
	Flags = "flags"
	// EndTime the field name of end time
	EndTime = "end"
	// StatusCode the field name of status code
	StatusCode = "statusCode"
	// StatusCodeField
	StatusCodeField = "statuscode"
)
View Source
const (
	AttributeComponent    = "component"
	AttributeEnduserID    = "enduser.id"
	AttributeEnduserRole  = "enduser.role"
	AttributeEnduserScope = "enduser.scope"
	AttributeNetHostIP    = "net.host.ip"
	AttributeNetHostName  = "net.host.name"
	AttributeNetHostPort  = "net.host.port"
	AttributeNetPeerIP    = "net.peer.ip"
	AttributeNetPeerName  = "net.peer.name"
	AttributeNetPeerPort  = "net.peer.port"
	AttributeNetTransport = "net.transport"
	AttributePeerService  = "peer.service"
)
View Source
const (
	AttributeCloudAccount               = "cloud.account.id"
	AttributeCloudProvider              = "cloud.provider"
	AttributeCloudRegion                = "cloud.region"
	AttributeCloudZone                  = "cloud.zone"
	AttributeCloudInfrastructureService = "cloud.infrastructure_service"
	AttributeContainerID                = "container.id"
	AttributeContainerImage             = "container.image.name"
	AttributeContainerName              = "container.name"
	AttributeContainerTag               = "container.image.tag"
	AttributeDeploymentEnvironment      = "deployment.environment"
	AttributeFaasID                     = "faas.id"
	AttributeFaasInstance               = "faas.instance"
	AttributeFaasName                   = "faas.name"
	AttributeFaasVersion                = "faas.version"
	AttributeHostID                     = "host.id"
	AttributeHostImageID                = "host.image.id"
	AttributeHostImageName              = "host.image.name"
	AttributeHostImageVersion           = "host.image.version"
	AttributeHostName                   = "host.name"
	AttributeHostType                   = "host.type"
	AttributeK8sCluster                 = "k8s.cluster.name"
	AttributeK8sContainer               = "k8s.container.name"
	AttributeK8sCronJob                 = "k8s.cronjob.name"
	AttributeK8sCronJobUID              = "k8s.cronjob.uid"
	AttributeK8sDaemonSet               = "k8s.daemonset.name"
	AttributeK8sDaemonSetUID            = "k8s.daemonset.uid"
	AttributeK8sDeployment              = "k8s.deployment.name"
	AttributeK8sDeploymentUID           = "k8s.deployment.uid"
	AttributeK8sJob                     = "k8s.job.name"
	AttributeK8sJobUID                  = "k8s.job.uid"
	AttributeK8sNamespace               = "k8s.namespace.name"
	AttributeK8sNodeName                = "k8s.node.name"
	AttributeK8sNodeUID                 = "k8s.node.uid"
	AttributeK8sPod                     = "k8s.pod.name"
	AttributeK8sPodUID                  = "k8s.pod.uid"
	AttributeK8sReplicaSet              = "k8s.replicaset.name"
	AttributeK8sReplicaSetUID           = "k8s.replicaset.uid"
	AttributeK8sStatefulSet             = "k8s.statefulset.name"
	AttributeK8sStatefulSetUID          = "k8s.statefulset.uid"
	AttributeOSType                     = "os.type"
	AttributeOSDescription              = "os.description"
	AttributeProcessCommand             = "process.command"
	AttributeProcessCommandLine         = "process.command_line"
	AttributeProcessExecutableName      = "process.executable.name"
	AttributeProcessExecutablePath      = "process.executable.path"
	AttributeProcessID                  = "process.pid"
	AttributeProcessOwner               = "process.owner"
	AttributeServiceInstance            = "service.instance.id"
	AttributeServiceName                = "service.name"
	AttributeServiceNamespace           = "service.namespace"
	AttributeServiceVersion             = "service.version"
	AttributeTelemetryAutoVersion       = "telemetry.auto.version"
	AttributeTelemetrySDKLanguage       = "telemetry.sdk.language"
	AttributeTelemetrySDKName           = "telemetry.sdk.name"
	AttributeTelemetrySDKVersion        = "telemetry.sdk.version"
)

Variables

View Source
var Status_StatusCode_value = map[string]int32{
	"STATUS_CODE_UNSET": 0,
	"STATUS_CODE_OK":    1,
	"STATUS_CODE_ERROR": 2,
}
View Source
var ZERO_TIME = errors.New("zero_time")

Functions

func Convert2OtelSpan

func Convert2OtelSpan(spans []*zipkinmodel.SpanModel) (data []*tracepb.ResourceSpans, e error)

func GetResourceSemanticConventionAttributeNames

func GetResourceSemanticConventionAttributeNames() []string

func SendToSls

func SendToSls(spans []*zipkinmodel.SpanModel, instance *producer.Producer, callback producer.CallBack, project string, log string) error

func TimestampFromTime

func TimestampFromTime(t time.Time) uint64

func ToSLSSpan

func ToSLSSpan(span *zipkinmodel.SpanModel) ([]*slsSdk.LogContent, error)

func ToSLSSpans

func ToSLSSpans(spans []*zipkinmodel.SpanModel) (lg *slsSdk.LogGroup, err error)

func UInt64ToSpanID

func UInt64ToSpanID(id uint64) []byte

func UInt64ToTraceID

func UInt64ToTraceID(high, low uint64) []byte

func UnmarshalSpanJSON

func UnmarshalSpanJSON(data []byte) (result []byte, e error)

func UnmarshalTraceJSON

func UnmarshalTraceJSON(data []byte) (result []byte, e error)

Types

type AttributeValueType

type AttributeValueType int
const (
	AttributeValueNULL AttributeValueType = iota
	AttributeValueSTRING
	AttributeValueINT
	AttributeValueDOUBLE
	AttributeValueBOOL
	AttributeValueMAP
	AttributeValueARRAY
)

func DetermineValueType

func DetermineValueType(value string, omitSimpleTypes bool) AttributeValueType

func (AttributeValueType) String

func (avt AttributeValueType) String() string

type Converter

type Converter interface {
	ParseSpans(protoBlob []byte, debugWasSet bool) (zss []*zipkinmodel.SpanModel, err error)
}

func NewConverter

func NewConverter(protocol string) Converter

type JsonConvertor

type JsonConvertor struct {
}

func (*JsonConvertor) ParseSpans

func (c *JsonConvertor) ParseSpans(protoBlob []byte, debugWasSet bool) (zss []*zipkinmodel.SpanModel, err error)

type ProtobufConvertor

type ProtobufConvertor struct {
}

func (*ProtobufConvertor) ParseSpans

func (c *ProtobufConvertor) ParseSpans(protoBlob []byte, debugWasSet bool) (zss []*zipkinmodel.SpanModel, err error)

Copy from zipking-go

type SpanLog

type SpanLog struct {
	Attribute map[string]interface{} `json:"attribute"`
	Time      uint64                 `json:"time"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL