tracespan

package
v0.0.0-...-4638b96 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package tracespan is a generated protocol buffer package.

The `tracespan` template represents an individual span within a distributed trace.

Example config:

```yaml apiVersion: "config.istio.io/v1alpha2" kind: tracespan metadata:

name: default
namespace: istio-system

spec:

traceId: request.headers["x-b3-traceid"]
spanId: request.headers["x-b3-spanid"] | ""
parentSpanId: request.headers["x-b3-parentspanid"] | ""
spanName: request.path | "/"
startTime: request.time
endTime: response.time
clientSpan: (context.reporter.kind | "inbound") == "inbound"
rewriteClientSpanId: false
spanTags:
  http.method: request.method | ""
  http.status_code: response.code | 200
  http.url: request.path | ""
  request.size: request.size | 0
  response.size: response.size | 0
  source.principal: source.principal | ""
  source.version: source.labels["version"] | ""

```

See also: [Distributed Tracing](https://istio.io/docs/tasks/telemetry/distributed-tracing/) for information on tracing within Istio.

TraceSpan represents an individual span within a distributed trace.

When writing the configuration, the value for the fields associated with this template can either be a literal or an [expression](https://istio.io/docs/reference//config/policy-and-telemetry/expression-language/). Please note that if the datatype of a field is not istio.policy.v1beta1.Value, then the expression's [inferred type](https://istio.io/docs/reference//config/policy-and-telemetry/expression-language/#type-checking) must match the datatype of the field.

It is generated from these files:

mixer/template/tracespan/tracespan_handler_service.proto

It has these top-level messages:

HandleTraceSpanRequest
InstanceMsg
Type
InstanceParam

Index

Constants

View Source
const TemplateName = "tracespan"

Fully qualified name of the template

Variables

View Source
var (
	ErrInvalidLengthTracespanHandlerService = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTracespanHandlerService   = fmt.Errorf("proto: integer overflow")
)

Functions

func RegisterHandleTraceSpanServiceServer

func RegisterHandleTraceSpanServiceServer(s *grpc.Server, srv HandleTraceSpanServiceServer)

Types

type HandleTraceSpanRequest

type HandleTraceSpanRequest struct {
	// 'tracespan' instances.
	Instances []*InstanceMsg `protobuf:"bytes,1,rep,name=instances" json:"instances,omitempty"`
	// Adapter specific handler configuration.
	//
	// Note: Backends can also implement [InfrastructureBackend][https://istio.io/docs/reference/config/mixer/istio.mixer.adapter.model.v1beta1.html#InfrastructureBackend]
	// service and therefore opt to receive handler configuration during session creation through [InfrastructureBackend.CreateSession][TODO: Link to this fragment]
	// call. In that case, adapter_config will have type_url as 'google.protobuf.Any.type_url' and would contain string
	// value of session_id (returned from InfrastructureBackend.CreateSession).
	AdapterConfig *google_protobuf1.Any `protobuf:"bytes,2,opt,name=adapter_config,json=adapterConfig" json:"adapter_config,omitempty"`
	// Id to dedupe identical requests from Mixer.
	DedupId string `protobuf:"bytes,3,opt,name=dedup_id,json=dedupId,proto3" json:"dedup_id,omitempty"`
}

Request message for HandleTraceSpan method.

func (*HandleTraceSpanRequest) Descriptor

func (*HandleTraceSpanRequest) Descriptor() ([]byte, []int)

func (*HandleTraceSpanRequest) Marshal

func (m *HandleTraceSpanRequest) Marshal() (dAtA []byte, err error)

func (*HandleTraceSpanRequest) MarshalTo

func (m *HandleTraceSpanRequest) MarshalTo(dAtA []byte) (int, error)

func (*HandleTraceSpanRequest) ProtoMessage

func (*HandleTraceSpanRequest) ProtoMessage()

func (*HandleTraceSpanRequest) Reset

func (m *HandleTraceSpanRequest) Reset()

func (*HandleTraceSpanRequest) Size

func (m *HandleTraceSpanRequest) Size() (n int)

func (*HandleTraceSpanRequest) String

func (this *HandleTraceSpanRequest) String() string

func (*HandleTraceSpanRequest) Unmarshal

func (m *HandleTraceSpanRequest) Unmarshal(dAtA []byte) error

type HandleTraceSpanServiceClient

type HandleTraceSpanServiceClient interface {
	// HandleTraceSpan is called by Mixer at request-time to deliver 'tracespan' instances to the backend.
	HandleTraceSpan(ctx context.Context, in *HandleTraceSpanRequest, opts ...grpc.CallOption) (*istio_mixer_adapter_model_v1beta11.ReportResult, error)
}

func NewHandleTraceSpanServiceClient

func NewHandleTraceSpanServiceClient(cc *grpc.ClientConn) HandleTraceSpanServiceClient

type HandleTraceSpanServiceServer

type HandleTraceSpanServiceServer interface {
	// HandleTraceSpan is called by Mixer at request-time to deliver 'tracespan' instances to the backend.
	HandleTraceSpan(context.Context, *HandleTraceSpanRequest) (*istio_mixer_adapter_model_v1beta11.ReportResult, error)
}

type Handler

type Handler interface {
	adapter.Handler

	// HandleTraceSpan is called by Mixer at request time to deliver instances to
	// to an adapter.
	HandleTraceSpan(context.Context, []*Instance) error
}

Handler must be implemented by adapter code if it wants to process data associated with the 'tracespan' template.

Mixer uses this interface to call into the adapter at request time in order to dispatch created instances to the adapter. Adapters take the incoming instances and do what they need to achieve their primary function.

The name of each instance can be used as a key into the Type map supplied to the adapter at configuration time via the method 'SetTraceSpanTypes'. These Type associated with an instance describes the shape of the instance

type HandlerBuilder

type HandlerBuilder interface {
	adapter.HandlerBuilder

	// SetTraceSpanTypes is invoked by Mixer to pass the template-specific Type information for instances that an adapter
	// may receive at runtime. The type information describes the shape of the instance.
	SetTraceSpanTypes(map[string]*Type)
}

HandlerBuilder must be implemented by adapters if they want to process data associated with the 'tracespan' template.

Mixer uses this interface to call into the adapter at configuration time to configure it with adapter-specific configuration as well as all template-specific type information.

type Instance

type Instance struct {
	// Name of the instance as specified in configuration.
	Name string

	// Trace ID is the unique identifier for a trace. All spans from the same
	// trace share the same Trace ID.
	//
	// Required.
	TraceId string

	// Span ID is the unique identifier for a span within a trace. It is assigned
	// when the span is created.
	//
	// Optional.
	SpanId string

	// Parent Span ID is the unique identifier for a parent span of this span
	// instance. If this is a root span, then this field MUST be empty.
	//
	// Optional.
	ParentSpanId string

	// Span name is a description of the span's operation.
	//
	// For example, the name can be a qualified method name or a file name
	// and a line number where the operation is called. A best practice is to use
	// the same display name within an application and at the same call point.
	// This makes it easier to correlate spans in different traces.
	//
	// Required.
	SpanName string

	// The start time of the span.
	//
	// Required.
	StartTime time.Time

	// The end time of the span.
	//
	// Required.
	EndTime time.Time

	// Span tags are a set of < key, value > pairs that provide metadata for the
	// entire span. The values can be specified in the form of expressions.
	//
	// Optional.
	SpanTags map[string]interface{}

	// HTTP status code used to set the span status. If unset or set to 0, the
	// span status will be assumed to be successful.
	HttpStatusCode int64

	// client_span indicates the span kind. True for client spans and False or
	// not provided for server spans. Using bool instead of enum is a temporary
	// work around since mixer expression language does not yet support enum
	// type.
	//
	// Optional
	ClientSpan bool

	// rewrite_client_span_id is used to indicate whether to create a new client
	// span id to accommodate Zipkin shared span model. Some tracing systems like
	// Stackdriver separates a RPC into client span and server span. To solve this
	// incompatibility, deterministically rewriting both span id of client span and
	// parent span id of server span to the same newly generated id.
	//
	// Optional
	RewriteClientSpanId bool

	// Identifies the source (client side) of this span.
	// Should usually be set to `source.workload.name`.
	//
	// Optional.
	SourceName string

	// Client IP address. Should usually be set to `source.ip`.
	//
	// Optional.
	SourceIp net.IP

	// Identifies the destination (server side) of this span.
	// Should usually be set to `destination.workload.name`.
	//
	// Optional.
	DestinationName string

	// Server IP address. Should usually be set to `destination.ip`.
	//
	// Optional.
	DestinationIp net.IP

	// Request body size. Should usually be set to `request.size`.
	//
	// Optional.
	RequestSize int64

	// Total request size (headers and body).
	// Should usually be set to `request.total_size`.
	//
	// Optional.
	RequestTotalSize int64

	// Response body size. Should usually be set to `response.size`.
	//
	// Optional.
	ResponseSize int64

	// Response total size (headers and body).
	// Should usually be set to `response.total_size`.
	//
	// Optional.
	ResponseTotalSize int64

	// One of "http", "https", or "grpc" or any other value of
	// the `api.protocol` attribute. Should usually be set to `api.protocol`.
	//
	// Optional.
	ApiProtocol string
}

Instance is constructed by Mixer for the 'tracespan' template.

TraceSpan represents an individual span within a distributed trace.

When writing the configuration, the value for the fields associated with this template can either be a literal or an [expression](https://istio.io/docs/reference//config/policy-and-telemetry/expression-language/). Please note that if the datatype of a field is not istio.policy.v1beta1.Value, then the expression's [inferred type](https://istio.io/docs/reference//config/policy-and-telemetry/expression-language/#type-checking) must match the datatype of the field.

type InstanceMsg

type InstanceMsg struct {
	// Name of the instance as specified in configuration.
	Name string `protobuf:"bytes,72295727,opt,name=name,proto3" json:"name,omitempty"`
	// Trace ID is the unique identifier for a trace. All spans from the same
	// trace share the same Trace ID.
	//
	// Required.
	TraceId string `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
	// Span ID is the unique identifier for a span within a trace. It is assigned
	// when the span is created.
	//
	// Optional.
	SpanId string `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"`
	// Parent Span ID is the unique identifier for a parent span of this span
	// instance. If this is a root span, then this field MUST be empty.
	//
	// Optional.
	ParentSpanId string `protobuf:"bytes,3,opt,name=parent_span_id,json=parentSpanId,proto3" json:"parent_span_id,omitempty"`
	// Span name is a description of the span's operation.
	//
	// For example, the name can be a qualified method name or a file name
	// and a line number where the operation is called. A best practice is to use
	// the same display name within an application and at the same call point.
	// This makes it easier to correlate spans in different traces.
	//
	// Required.
	SpanName string `protobuf:"bytes,4,opt,name=span_name,json=spanName,proto3" json:"span_name,omitempty"`
	// The start time of the span.
	//
	// Required.
	StartTime *istio_policy_v1beta1.TimeStamp `protobuf:"bytes,5,opt,name=start_time,json=startTime" json:"start_time,omitempty"`
	// The end time of the span.
	//
	// Required.
	EndTime *istio_policy_v1beta1.TimeStamp `protobuf:"bytes,6,opt,name=end_time,json=endTime" json:"end_time,omitempty"`
	// Span tags are a set of < key, value > pairs that provide metadata for the
	// entire span. The values can be specified in the form of expressions.
	//
	// Optional.
	SpanTags map[string]*istio_policy_v1beta1.Value `` /* 159-byte string literal not displayed */
	// HTTP status code used to set the span status. If unset or set to 0, the
	// span status will be assumed to be successful.
	HttpStatusCode int64 `protobuf:"varint,8,opt,name=httpStatusCode,proto3" json:"httpStatusCode,omitempty"`
	// client_span indicates the span kind. True for client spans and False or
	// not provided for server spans. Using bool instead of enum is a temporary
	// work around since mixer expression language does not yet support enum
	// type.
	//
	// Optional
	ClientSpan bool `protobuf:"varint,9,opt,name=client_span,json=clientSpan,proto3" json:"client_span,omitempty"`
	// rewrite_client_span_id is used to indicate whether to create a new client
	// span id to accommodate Zipkin shared span model. Some tracing systems like
	// Stackdriver separates a RPC into client span and server span. To solve this
	// incompatibility, deterministically rewriting both span id of client span and
	// parent span id of server span to the same newly generated id.
	//
	// Optional
	RewriteClientSpanId bool `protobuf:"varint,10,opt,name=rewrite_client_span_id,json=rewriteClientSpanId,proto3" json:"rewrite_client_span_id,omitempty"`
	// Identifies the source (client side) of this span.
	// Should usually be set to `source.workload.name`.
	//
	// Optional.
	SourceName string `protobuf:"bytes,11,opt,name=source_name,json=sourceName,proto3" json:"source_name,omitempty"`
	// Client IP address. Should usually be set to `source.ip`.
	//
	// Optional.
	SourceIp *istio_policy_v1beta1.IPAddress `protobuf:"bytes,12,opt,name=source_ip,json=sourceIp" json:"source_ip,omitempty"`
	// Identifies the destination (server side) of this span.
	// Should usually be set to `destination.workload.name`.
	//
	// Optional.
	DestinationName string `protobuf:"bytes,13,opt,name=destination_name,json=destinationName,proto3" json:"destination_name,omitempty"`
	// Server IP address. Should usually be set to `destination.ip`.
	//
	// Optional.
	DestinationIp *istio_policy_v1beta1.IPAddress `protobuf:"bytes,14,opt,name=destination_ip,json=destinationIp" json:"destination_ip,omitempty"`
	// Request body size. Should usually be set to `request.size`.
	//
	// Optional.
	RequestSize int64 `protobuf:"varint,15,opt,name=request_size,json=requestSize,proto3" json:"request_size,omitempty"`
	// Total request size (headers and body).
	// Should usually be set to `request.total_size`.
	//
	// Optional.
	RequestTotalSize int64 `protobuf:"varint,16,opt,name=request_total_size,json=requestTotalSize,proto3" json:"request_total_size,omitempty"`
	// Response body size. Should usually be set to `response.size`.
	//
	// Optional.
	ResponseSize int64 `protobuf:"varint,17,opt,name=response_size,json=responseSize,proto3" json:"response_size,omitempty"`
	// Response total size (headers and body).
	// Should usually be set to `response.total_size`.
	//
	// Optional.
	ResponseTotalSize int64 `protobuf:"varint,18,opt,name=response_total_size,json=responseTotalSize,proto3" json:"response_total_size,omitempty"`
	// One of "http", "https", or "grpc" or any other value of
	// the `api.protocol` attribute. Should usually be set to `api.protocol`.
	//
	// Optional.
	ApiProtocol string `protobuf:"bytes,19,opt,name=api_protocol,json=apiProtocol,proto3" json:"api_protocol,omitempty"`
}

Contains instance payload for 'tracespan' template. This is passed to infrastructure backends during request-time through HandleTraceSpanService.HandleTraceSpan.

func (*InstanceMsg) Descriptor

func (*InstanceMsg) Descriptor() ([]byte, []int)

func (*InstanceMsg) Marshal

func (m *InstanceMsg) Marshal() (dAtA []byte, err error)

func (*InstanceMsg) MarshalTo

func (m *InstanceMsg) MarshalTo(dAtA []byte) (int, error)

func (*InstanceMsg) ProtoMessage

func (*InstanceMsg) ProtoMessage()

func (*InstanceMsg) Reset

func (m *InstanceMsg) Reset()

func (*InstanceMsg) Size

func (m *InstanceMsg) Size() (n int)

func (*InstanceMsg) String

func (this *InstanceMsg) String() string

func (*InstanceMsg) Unmarshal

func (m *InstanceMsg) Unmarshal(dAtA []byte) error

type InstanceParam

type InstanceParam struct {
	// Trace ID is the unique identifier for a trace. All spans from the same
	// trace share the same Trace ID.
	//
	// Required.
	TraceId string `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
	// Span ID is the unique identifier for a span within a trace. It is assigned
	// when the span is created.
	//
	// Optional.
	SpanId string `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"`
	// Parent Span ID is the unique identifier for a parent span of this span
	// instance. If this is a root span, then this field MUST be empty.
	//
	// Optional.
	ParentSpanId string `protobuf:"bytes,3,opt,name=parent_span_id,json=parentSpanId,proto3" json:"parent_span_id,omitempty"`
	// Span name is a description of the span's operation.
	//
	// For example, the name can be a qualified method name or a file name
	// and a line number where the operation is called. A best practice is to use
	// the same display name within an application and at the same call point.
	// This makes it easier to correlate spans in different traces.
	//
	// Required.
	SpanName string `protobuf:"bytes,4,opt,name=span_name,json=spanName,proto3" json:"span_name,omitempty"`
	// The start time of the span.
	//
	// Required.
	StartTime string `protobuf:"bytes,5,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	// The end time of the span.
	//
	// Required.
	EndTime string `protobuf:"bytes,6,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
	// Span tags are a set of < key, value > pairs that provide metadata for the
	// entire span. The values can be specified in the form of expressions.
	//
	// Optional.
	SpanTags map[string]string `` /* 166-byte string literal not displayed */
	// HTTP status code used to set the span status. If unset or set to 0, the
	// span status will be assumed to be successful.
	HttpStatusCode string `protobuf:"bytes,8,opt,name=httpStatusCode,proto3" json:"httpStatusCode,omitempty"`
	// client_span indicates the span kind. True for client spans and False or
	// not provided for server spans. Using bool instead of enum is a temporary
	// work around since mixer expression language does not yet support enum
	// type.
	//
	// Optional
	ClientSpan string `protobuf:"bytes,9,opt,name=client_span,json=clientSpan,proto3" json:"client_span,omitempty"`
	// rewrite_client_span_id is used to indicate whether to create a new client
	// span id to accommodate Zipkin shared span model. Some tracing systems like
	// Stackdriver separates a RPC into client span and server span. To solve this
	// incompatibility, deterministically rewriting both span id of client span and
	// parent span id of server span to the same newly generated id.
	//
	// Optional
	RewriteClientSpanId string `protobuf:"bytes,10,opt,name=rewrite_client_span_id,json=rewriteClientSpanId,proto3" json:"rewrite_client_span_id,omitempty"`
	// Identifies the source (client side) of this span.
	// Should usually be set to `source.workload.name`.
	//
	// Optional.
	SourceName string `protobuf:"bytes,11,opt,name=source_name,json=sourceName,proto3" json:"source_name,omitempty"`
	// Client IP address. Should usually be set to `source.ip`.
	//
	// Optional.
	SourceIp string `protobuf:"bytes,12,opt,name=source_ip,json=sourceIp,proto3" json:"source_ip,omitempty"`
	// Identifies the destination (server side) of this span.
	// Should usually be set to `destination.workload.name`.
	//
	// Optional.
	DestinationName string `protobuf:"bytes,13,opt,name=destination_name,json=destinationName,proto3" json:"destination_name,omitempty"`
	// Server IP address. Should usually be set to `destination.ip`.
	//
	// Optional.
	DestinationIp string `protobuf:"bytes,14,opt,name=destination_ip,json=destinationIp,proto3" json:"destination_ip,omitempty"`
	// Request body size. Should usually be set to `request.size`.
	//
	// Optional.
	RequestSize string `protobuf:"bytes,15,opt,name=request_size,json=requestSize,proto3" json:"request_size,omitempty"`
	// Total request size (headers and body).
	// Should usually be set to `request.total_size`.
	//
	// Optional.
	RequestTotalSize string `protobuf:"bytes,16,opt,name=request_total_size,json=requestTotalSize,proto3" json:"request_total_size,omitempty"`
	// Response body size. Should usually be set to `response.size`.
	//
	// Optional.
	ResponseSize string `protobuf:"bytes,17,opt,name=response_size,json=responseSize,proto3" json:"response_size,omitempty"`
	// Response total size (headers and body).
	// Should usually be set to `response.total_size`.
	//
	// Optional.
	ResponseTotalSize string `protobuf:"bytes,18,opt,name=response_total_size,json=responseTotalSize,proto3" json:"response_total_size,omitempty"`
	// One of "http", "https", or "grpc" or any other value of
	// the `api.protocol` attribute. Should usually be set to `api.protocol`.
	//
	// Optional.
	ApiProtocol string `protobuf:"bytes,19,opt,name=api_protocol,json=apiProtocol,proto3" json:"api_protocol,omitempty"`
}

Represents instance configuration schema for 'tracespan' template.

func (*InstanceParam) Descriptor

func (*InstanceParam) Descriptor() ([]byte, []int)

func (*InstanceParam) Marshal

func (m *InstanceParam) Marshal() (dAtA []byte, err error)

func (*InstanceParam) MarshalTo

func (m *InstanceParam) MarshalTo(dAtA []byte) (int, error)

func (*InstanceParam) ProtoMessage

func (*InstanceParam) ProtoMessage()

func (*InstanceParam) Reset

func (m *InstanceParam) Reset()

func (*InstanceParam) Size

func (m *InstanceParam) Size() (n int)

func (*InstanceParam) String

func (this *InstanceParam) String() string

func (*InstanceParam) Unmarshal

func (m *InstanceParam) Unmarshal(dAtA []byte) error

type Type

type Type struct {
	// Span tags are a set of < key, value > pairs that provide metadata for the
	// entire span. The values can be specified in the form of expressions.
	//
	// Optional.
	SpanTags map[string]istio_policy_v1beta11.ValueType `` /* 203-byte string literal not displayed */
}

Contains inferred type information about specific instance of 'tracespan' template. This is passed to infrastructure backends during configuration-time through [InfrastructureBackend.CreateSession][TODO: Link to this fragment].

func (*Type) Descriptor

func (*Type) Descriptor() ([]byte, []int)

func (*Type) Marshal

func (m *Type) Marshal() (dAtA []byte, err error)

func (*Type) MarshalTo

func (m *Type) MarshalTo(dAtA []byte) (int, error)

func (*Type) ProtoMessage

func (*Type) ProtoMessage()

func (*Type) Reset

func (m *Type) Reset()

func (*Type) Size

func (m *Type) Size() (n int)

func (*Type) String

func (this *Type) String() string

func (*Type) Unmarshal

func (m *Type) Unmarshal(dAtA []byte) error

Jump to

Keyboard shortcuts

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