Documentation ¶
Index ¶
- Constants
- Variables
- func AddAttributesToSpan(span trace.Span, attributes map[string]string)
- func ConstructInputBindingSpanAttributes(bindingName, url string) map[string]string
- func ConstructSubscriptionSpanAttributes(topic string) map[string]string
- func ElapsedSince(start time.Time) float64
- func GRPCTraceStreamServerInterceptor(appID string, spec config.TracingSpec) grpc.StreamServerInterceptor
- func GRPCTraceUnaryServerInterceptor(appID string, spec config.TracingSpec) grpc.UnaryServerInterceptor
- func HTTPTraceMiddleware(next http.Handler, appID string, spec config.TracingSpec) http.Handler
- func InitMetrics(appID, namespace string, metricSpec config.MetricSpec) error
- func NewDaprTraceSampler(samplingRateString string) sdktrace.Sampler
- func ResiliencyActorTarget(actorType string) string
- func ResiliencyAppTarget(app string) string
- func ResiliencyComponentTarget(name string, componentType string) string
- func SpanContextFromIncomingGRPCMetadata(ctx context.Context) (trace.SpanContext, bool)
- func SpanContextFromRequest(r *http.Request) (sc trace.SpanContext)
- func SpanContextFromW3CString(h string) (sc trace.SpanContext, ok bool)
- func SpanContextToGRPCMetadata(ctx context.Context, spanContext trace.SpanContext) context.Context
- func SpanContextToHTTPHeaders(sc trace.SpanContext, setHeader func(string, string))
- func SpanContextToW3CString(sc trace.SpanContext) string
- func StartGRPCProducerSpanChildFromParent(ct context.Context, parentSpan trace.Span, spanName string) (context.Context, trace.Span)
- func StartInternalCallbackSpan(ctx context.Context, spanName string, parent trace.SpanContext, ...) (context.Context, trace.Span)
- func StartProducerSpanChildFromParent(ctx *fasthttp.RequestCtx, parentSpan trace.Span) trace.Span
- func TraceIDAndStateFromSpan(span trace.Span) (string, string)
- func TraceStateFromW3CString(h string) *trace.TraceState
- func TraceStateToW3CString(sc trace.SpanContext) string
- func UpdateSpanStatusFromGRPCError(span trace.Span, err error)
- func UpdateSpanStatusFromHTTPStatus(span trace.Span, code int)
- type HTTPMonitoringConfig
- type PolicyFlowDirection
- type PolicyType
Constants ¶
const ( Delete = "delete" Get = "get" Set = "set" StateQuery = "query" ConfigurationSubscribe = "subscribe" ConfigurationUnsubscribe = "unsubscribe" StateTransaction = "transaction" BulkGet = "bulk_get" BulkDelete = "bulk_delete" CryptoOp = "crypto_op" )
const ( GRPCTraceContextKey = "grpc-trace-bin" GRPCProxyAppIDKey = "dapr-app-id" )
const ( TraceparentHeader = "traceparent" TracestateHeader = "tracestate" )
We have leveraged the code from opencensus-go plugin to adhere the w3c trace context. Reference : https://github.com/census-instrumentation/opencensus-go/blob/master/plugin/ochttp/propagation/tracecontext/propagation.go
const ( StatusSuccess = "success" StatusFailed = "failed" StatusRecoverable = "recoverable" CreateWorkflow = "create_workflow" GetWorkflow = "get_workflow" AddEvent = "add_event" PurgeWorkflow = "purge_workflow" WorkflowEvent = "event" Timer = "timer" )
Variables ¶
var ( KeyServerMethod = tag.MustNewKey("grpc_server_method") KeyServerStatus = tag.MustNewKey("grpc_server_status") KeyClientMethod = tag.MustNewKey("grpc_client_method") KeyClientStatus = tag.MustNewKey("grpc_client_status") )
Tag key definitions for http requests.
var ( // DefaultReportingPeriod is the default view reporting period. DefaultReportingPeriod = 1 * time.Minute // DefaultMonitoring holds service monitoring metrics definitions. DefaultMonitoring = newServiceMetrics() // DefaultGRPCMonitoring holds default gRPC monitoring handlers and middlewares. DefaultGRPCMonitoring = newGRPCMetrics() // DefaultHTTPMonitoring holds default HTTP monitoring handlers and middlewares. DefaultHTTPMonitoring = newHTTPMetrics() // DefaultComponentMonitoring holds component specific metrics. DefaultComponentMonitoring = newComponentMetrics() // DefaultResiliencyMonitoring holds resiliency specific metrics. DefaultResiliencyMonitoring = newResiliencyMetrics() // DefaultWorkflowMonitoring holds workflow specific metrics. DefaultWorkflowMonitoring = newWorkflowMetrics() )
var ( CircuitBreakerPolicy PolicyType = "circuitbreaker" RetryPolicy PolicyType = "retry" TimeoutPolicy PolicyType = "timeout" OutboundPolicyFlowDirection PolicyFlowDirection = "outbound" InboundPolicyFlowDirection PolicyFlowDirection = "inbound" )
Functions ¶
func AddAttributesToSpan ¶
AddAttributesToSpan adds the given attributes in the span.
func ConstructInputBindingSpanAttributes ¶
ConstructInputBindingSpanAttributes creates span attributes for InputBindings.
func ConstructSubscriptionSpanAttributes ¶
ConstructSubscriptionSpanAttributes creates span attributes for Pubsub subscription.
func ElapsedSince ¶
func GRPCTraceStreamServerInterceptor ¶
func GRPCTraceStreamServerInterceptor(appID string, spec config.TracingSpec) grpc.StreamServerInterceptor
GRPCTraceStreamServerInterceptor sets the trace context or starts the trace client span based on request. This is used by proxy requests too.
func GRPCTraceUnaryServerInterceptor ¶
func GRPCTraceUnaryServerInterceptor(appID string, spec config.TracingSpec) grpc.UnaryServerInterceptor
GRPCTraceUnaryServerInterceptor sets the trace context or starts the trace client span based on request.
func HTTPTraceMiddleware ¶
HTTPTraceMiddleware sets the trace context or starts the trace client span based on request.
func InitMetrics ¶
func InitMetrics(appID, namespace string, metricSpec config.MetricSpec) error
InitMetrics initializes metrics.
func NewDaprTraceSampler ¶
func ResiliencyActorTarget ¶
func ResiliencyAppTarget ¶
func SpanContextFromIncomingGRPCMetadata ¶
func SpanContextFromIncomingGRPCMetadata(ctx context.Context) (trace.SpanContext, bool)
SpanContextFromIncomingGRPCMetadata returns the SpanContext stored in incoming metadata of context, or empty if there isn't one.
func SpanContextFromRequest ¶
func SpanContextFromRequest(r *http.Request) (sc trace.SpanContext)
SpanContextFromRequest extracts a span context from incoming requests.
func SpanContextFromW3CString ¶
func SpanContextFromW3CString(h string) (sc trace.SpanContext, ok bool)
SpanContextFromW3CString extracts a span context from given string which got earlier from SpanContextToW3CString format.
func SpanContextToGRPCMetadata ¶
SpanContextToGRPCMetadata appends binary serialized SpanContext to the outgoing GRPC context.
func SpanContextToHTTPHeaders ¶
func SpanContextToHTTPHeaders(sc trace.SpanContext, setHeader func(string, string))
SpanContextToHTTPHeaders adds the spancontext in traceparent and tracestate headers.
func SpanContextToW3CString ¶
func SpanContextToW3CString(sc trace.SpanContext) string
SpanContextToW3CString returns the SpanContext string representation.
func StartInternalCallbackSpan ¶
func StartInternalCallbackSpan(ctx context.Context, spanName string, parent trace.SpanContext, spec *config.TracingSpec) (context.Context, trace.Span)
StartInternalCallbackSpan starts trace span for internal callback such as input bindings and pubsub subscription.
func TraceStateFromW3CString ¶
func TraceStateFromW3CString(h string) *trace.TraceState
TraceStateFromW3CString extracts a span tracestate from given string which got earlier from TraceStateFromW3CString format.
func TraceStateToW3CString ¶
func TraceStateToW3CString(sc trace.SpanContext) string
TraceStateToW3CString extracts the TraceState from given SpanContext and returns its string representation.
func UpdateSpanStatusFromGRPCError ¶
UpdateSpanStatusFromGRPCError updates tracer span status based on error object.
func UpdateSpanStatusFromHTTPStatus ¶
UpdateSpanStatusFromHTTPStatus updates trace span status based on response code.
Types ¶
type HTTPMonitoringConfig ¶
type HTTPMonitoringConfig struct {
// contains filtered or unexported fields
}
func NewHTTPMonitoringConfig ¶
func NewHTTPMonitoringConfig(pathMatching []string, legacy, excludeVerbs bool) HTTPMonitoringConfig
type PolicyFlowDirection ¶
type PolicyFlowDirection string
type PolicyType ¶
type PolicyType string