package
0.0.3
Repository: https://github.com/hujingwei/go-zero.git
Documentation: pkg.go.dev

# README

net/trace

项目简介

  1. 提供Trace的接口规范
  2. 提供 trace 对Tracer接口的实现,供业务接入使用

接入示例

  1. 启动接入示例
    trace.Init(traceConfig) // traceConfig is Config object with value.
    
  2. 配置参考
    [tracer]
    network = "unixgram"
    addr = "/var/run/dapper-collect/dapper-collect.sock"
    

测试

  1. 执行当前目录下所有测试文件,测试所有功能

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

Bool new tagBool NOTE: use TagBool.
Close trace flush data.
EnableDebug enable debug mode.
Extract returns a Trace instance given `format` and `carrier`.
FromContext returns the trace bound to the context, if any.
Init init trace report.
Inject takes the Trace instance and injects it for propagation within `carrier`.
Int new tag Int.
Log new log.
New trace instance with given operationName.
NewContext new a trace context.
NewTracer new a tracer.
SetGlobalTracer SetGlobalTracer.
String new tag String.
TagBool new bool tag.
TagFloat32 new float64 tag.
TagFloat64 new float64 tag.
TagInt new int tag.
TagInt64 new int64 tag.
TagString new string tag.
TracerFromEnvFlag new tracer from env and flag.

# Constants

GRPCFormat represents Trace as gRPC metadata.
HTTPFormat represents Trace as HTTP header string pairs.
Trace key.
Trace key.
The type or "kind" of an error (only for event="error" logs).
For languages that support such a thing (e.g., Java, Python), the actual Throwable/Exception/Error object instance itself.
A stable identifier for some notable moment in the lifetime of a Span.
A concise, human-readable, one-line message explaining the event.
A stack trace in platform-conventional format; may or may not pertain to an error.
Standard Span tags https://github.com/opentracing/specification/blob/master/semantic_conventions.md#span-tags-table.
legacy tag.
Standard Span tags https://github.com/opentracing/specification/blob/master/semantic_conventions.md#span-tags-table.
The software package, framework, library, or module that generated the associated Span.
Database instance name.
A database statement for the given database type.
Database type.
Username for accessing database.
true if and only if the application considers the operation represented by the Span to have failed type bool.
HTTP method of the request for the associated Span.
HTTP response status code for the associated Span.
URL of the request being handled in this segment of the trace, in standard URI format.
An address at which messages can be exchanged.
Remote "address", suitable for use in a networking client library.
Remote hostname.
Remote IPv4 address as a .-separated tuple.
Remote IPv6 address as a string of colon-separated 4-char hex tuples.
Remote port.
Remote service name (for some unspecified definition of "service").
If greater than 0, a hint to the Tracer to do its best to capture the trace.
Either "client" or "server" for the appropriate roles in an RPC, and "producer" or "consumer" for the appropriate roles in a messaging scenario.

# Variables

ErrInvalidCarrier errors occur when Tracer.Inject() or Tracer.Extract() implementations expect a different type of `carrier` than they are given.
ErrInvalidTrace errors occur when Tracer.Inject() is asked to operate on a Trace which it is not prepared to handle (for example, since it was created by a different tracer implementation).
ErrTraceCorrupted occurs when the `carrier` passed to Tracer.Extract() is of the expected type but is corrupted.
ErrTraceNotFound occurs when the `carrier` passed to Tracer.Extract() is valid and uncorrupted but has insufficient information to extract a Trace.
ErrUnsupportedFormat occurs when the `format` passed to Tracer.Inject() or Tracer.Extract() is not recognized by the Tracer implementation.

# Structs

Config config.
LogField LogField.
Span is a trace span.
Tag interface.

# Interfaces

Carrier propagator must convert generic interface{} to something this implement Carrier interface, Trace can use Carrier to represents itself.
Trace trace common interface.
Tracer is a simple, thin interface for Trace creation and propagation.

# Type aliases

BuiltinFormat is used to demarcate the values within package `trace` that are intended for use with the Tracer.Inject() and Tracer.Extract() methods.
Option dapper Option.