Documentation ¶
Overview ¶
* Copyright 2021 NAVER Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- Variables
- func AddIgnoreUrls(urls ...string)
- func AgentIsDisabled() bool
- func GenerateTid() string
- func GetAppName() string
- func IsIgnore(url string) bool
- func Logf(format string, v ...interface{})
- func PinTranscation(header *PinTransactionHeader, pile FuncPile, ctx context.Context)
- func Pinpoint_add_clue(key, value string, id TraceIdType, loc LocationType)
- func Pinpoint_add_clues(key, value string, id TraceIdType, loc LocationType)
- func Pinpoint_drop_trace(id TraceIdType)
- func Pinpoint_enable_debug_report(enable bool)
- func Pinpoint_enable_utest()
- func Pinpoint_gen_sid() string
- func Pinpoint_gen_tid() string
- func Pinpoint_get_context(key string, id TraceIdType) string
- func Pinpoint_get_int_context(key string, id TraceIdType) (int64, error)
- func Pinpoint_mark_error(emsg, error_filename string, error_lineno uint32, id TraceIdType)
- func Pinpoint_set_collect_agent_host(host string)
- func Pinpoint_set_context(key, value string, id TraceIdType)
- func Pinpoint_set_int_context(key string, value int64, id TraceIdType)
- func Pinpoint_set_trace_limit(limitPerSec int32)
- func Pinpoint_start_time() int64
- func Pinpoint_trace_is_root(id TraceIdType) bool
- func Pinpoint_tracelimit() bool
- func Pinpoint_unique_id() int64
- func Pinpoint_wake_trace(id TraceIdType) error
- func SetLogCallBack(callback func(format string, v ...interface{}))
- type DeferFunc
- func PinFuncOnce(ctx context.Context, name string, args ...interface{}) (context.Context, DeferFunc)
- func PinFuncSum(ctx context.Context, name string, args ...interface{}) (context.Context, DeferFunc)
- func PinHttpClientFunc(ctx context.Context, name, remoteUrl string, args ...interface{}) (context.Context, DeferFunc)
- type FuncPile
- type LocationType
- type PinTransactionHeader
- type TRACE_ID_TYPE
- type TraceIdType
Constants ¶
const ( PP_HTTP_PINPOINT_PSPANID = "HTTP_PINPOINT_PSPANID" PP_HTTP_PINPOINT_SPANID = "HTTP_PINPOINT_SPANID" PP_HTTP_PINPOINT_TRACEID = "HTTP_PINPOINT_TRACEID" PP_HTTP_PINPOINT_PAPPNAME = "HTTP_PINPOINT_PAPPNAME" PP_HTTP_PINPOINT_PAPPTYPE = "HTTP_PINPOINT_PAPPTYPE" PP_HTTP_PINPOINT_HOST = "HTTP_PINPOINT_HOST" PP_HEADER_PINPOINT_PSPANID = "Pinpoint-Pspanid" PP_HEADER_PINPOINT_SPANID = "Pinpoint-Spanid" PP_HEADER_PINPOINT_TRACEID = "Pinpoint-Traceid" PP_HEADER_PINPOINT_PAPPNAME = "Pinpoint-Pappname" PP_HEADER_PINPOINT_PAPPTYPE = "Pinpoint-Papptype" PP_HEADER_PINPOINT_HOST = "Pinpoint-Host" PP_HEADER_PINPOINT_CLIENT = "Pinpoint-Client" PP_HEADER_NGINX_PROXY = "Pinpoint-ProxyNginx" PP_HTTP_NGINX_PROXY = "HTTP_Pinpoint-ProxyNginx" PP_HEADER_APACHE_PROXY = "PINPOINT-PROXYAPACHE" PP_HTTP_APACHE_PROXY = "HTTP_PINPOINT_PROXYAPACHE" PP_HEADER_PINPOINT_SAMPLED = "Pinpoint-Sampled" PP_HTTP_PINPOINT_SAMPLED = "HTTP_PINPOINT_SAMPLED" PP_DESTINATION = "dst" PP_INTERCEPTOR_NAME = "name" PP_APP_NAME = "appname" PP_APP_ID = "appid" PP_REQ_URI = "uri" PP_REQ_CLIENT = "client" PP_REQ_SERVER = "server" PP_SERVER_TYPE = "stp" PP_AGENT_TYPE = "FT" PP_PARENT_SPAN_ID = "psid" PP_PARENT_NAME = "pname" PP_PARENT_TYPE = "ptype" PP_PARENT_HOST = "Ah" PP_NGINX_PROXY = "NP" PP_APACHE_PROXY = "AP" PP_TRANSCATION_ID = "tid" PP_SPAN_ID = "sid" PP_NOT_SAMPLED = "s0" PP_SAMPLED = "s1" PP_NEXT_SPAN_ID = "nsid" PP_ADD_EXCEPTION = "EXP" PP_SQL_FORMAT = "SQL" PP_ARGS = "-1" PP_RETURN = "14" GOLANG = "1800" PP_METHOD_CALL = "1801" PP_CELERY = "1702" PP_REMOTE_METHOD = "9401" PP_HTTP_URL = "40" PP_HTTP_PARAM = "41" PP_HTTP_PARAM_ENTITY = "42" PP_HTTP_COOKIE = "45" PP_HTTP_STATUS_CODE = "46" PP_HTTP_METHOD = "206" PP_HTTP_INTERNAL_DISPLAY = 48 PP_HTTP_IO = 49 PP_MESSAGE_QUEUE_URI = 100 PP_MYSQL = "2101" PP_REDIS = "8200" PP_REDIS_REDISSON = "8203" PP_REDIS_REDISSON_INTERNAL = "8204" PP_POSTGRESQL = "2501" PP_MEMCACHED = "8050" PP_MEMCACHED_FUTURE_GET = "8051" PP_MONGDB_EXE_QUERY = "2651" PP_KAFKA = "8660" PP_KAFKA_TOPIC = "140" PP_RABBITMQ_CLIENT = "8300" PP_RABBITMQ_EXCHANGEKEY = "130" PP_RABBITMQ_ROUTINGKEY = "131" )
/////////////////////////////////////// copy from pinpoint-python
Variables ¶
var ( Appname string Appid string )
Functions ¶
func AddIgnoreUrls ¶
func AddIgnoreUrls(urls ...string)
*
- @description: Middleware use this to exclude some urls
- @param {...string} urls
- @return {*}
func AgentIsDisabled ¶ added in v1.0.3
func AgentIsDisabled() bool
*
- @description:
- if FORCE_DISABLE_PINPOINT_AGENT ==true, aop,middleware could not working after restart
- user can evn FORCE_DISABLE_PINPOINT_AGENT=true to disable pinpoint agent without recompiling binary program
func GenerateTid ¶ added in v1.0.4
func GenerateTid() string
func GetAppName ¶ added in v1.0.4
func GetAppName() string
func IsIgnore ¶
*
- @description: Check url is ignore by `AddIgnoreUrls`
- @param {string} url
- @return {*}
func PinTranscation ¶ added in v1.0.4
func PinTranscation(header *PinTransactionHeader, pile FuncPile, ctx context.Context)
func Pinpoint_add_clue ¶
func Pinpoint_add_clue(key, value string, id TraceIdType, loc LocationType)
* * @description: Attach some information on current trace node * @param {TraceIdType} id: trace node identifier * @param {string} key * @param {string} value * @return {*}
func Pinpoint_add_clues ¶
func Pinpoint_add_clues(key, value string, id TraceIdType, loc LocationType)
*
- @description: The same as `Pinpoint_add_clue`. API for add annotation.
- @param {*} key
- @param {string} value
- @param {TraceIdType} id
- @param {LocationType} loc
- @return {*}
func Pinpoint_drop_trace ¶
func Pinpoint_drop_trace(id TraceIdType)
*
- @description: Drop current trace tree(trace id).
- A dropped trace tree will not send to pinpoint-collector
- @param {TraceIdType} id
- @return {*}
func Pinpoint_enable_debug_report ¶
func Pinpoint_enable_debug_report(enable bool)
*
- @description: For Debug, trace the pinpoint
- @param {bool} enable
- @return {*}
func Pinpoint_enable_utest ¶
func Pinpoint_enable_utest()
*
- @description: unittest only
- @param {*}
- @return {*}
func Pinpoint_gen_sid ¶
func Pinpoint_gen_sid() string
*
- @description: A random number from [0,2147483647)
- @param {*}
- @return {*}
func Pinpoint_gen_tid ¶
func Pinpoint_gen_tid() string
*
- @description: geneate a transaction id for a span.
- format: APPID^Start time^A random number
- @param {*}
- @return {*}
func Pinpoint_get_context ¶
func Pinpoint_get_context(key string, id TraceIdType) string
*
- @description: Get current trace tree context by key
- @param {string} key
- @param {TraceIdType} id
- @return {*} "" if not exist! So DO NOT set "" into context.
func Pinpoint_get_int_context ¶ added in v1.0.4
func Pinpoint_get_int_context(key string, id TraceIdType) (int64, error)
func Pinpoint_mark_error ¶
func Pinpoint_mark_error(emsg, error_filename string, error_lineno uint32, id TraceIdType)
*
- @description: Pinpoint-web doesn't know which span is error until you tell him.
- @param {*} emsg
- @param {string} error_filename
- @param {uint32} error_lineno
- @param {TraceIdType} id
- @return {*}
func Pinpoint_set_collect_agent_host ¶
func Pinpoint_set_collect_agent_host(host string)
*
- @description: Set collector-agent host
- @param {string} host: tcp:dev.collector:9999
- @return {*}
func Pinpoint_set_context ¶
func Pinpoint_set_context(key, value string, id TraceIdType)
*
- @description: Store some information on current trace tree.
- context will be free when trace tree end.
- @param {*} key
- @param {string} value
- @param {TraceIdType} id
- @return {*}
func Pinpoint_set_int_context ¶ added in v1.0.4
func Pinpoint_set_int_context(key string, value int64, id TraceIdType)
func Pinpoint_set_trace_limit ¶
func Pinpoint_set_trace_limit(limitPerSec int32)
*
- @description: set trace_limit.
- @param {int32} limitPerSec times per second.(-1 means no limit)
- @return {*}
func Pinpoint_start_time ¶
func Pinpoint_start_time() int64
*
- @description: Agent first run time
- @param {*}
- @return {*}
func Pinpoint_trace_is_root ¶
func Pinpoint_trace_is_root(id TraceIdType) bool
*
- @description: check current trace node is root node or not
- @param {TraceIdType} id
- @return {*}
func Pinpoint_tracelimit ¶
func Pinpoint_tracelimit() bool
*
- @description: Check sample speed is reached the limit or not.
- @param {*}
- @return {*} true: current trace should be dropped. false: not limited
func Pinpoint_unique_id ¶
func Pinpoint_unique_id() int64
*
- @description: An unique id per host
- @param {*}
- @return {*}
func Pinpoint_wake_trace ¶ added in v1.0.4
func Pinpoint_wake_trace(id TraceIdType) error
func SetLogCallBack ¶
func SetLogCallBack(callback func(format string, v ...interface{}))
*
- @description: logger callback. if you want to specify your own logger callback
- common.SetLogCallBack(callback) // nil => drop everything
- @param {string} format
- @param {...interface{}} v
- @return {*}
Types ¶
type DeferFunc ¶ added in v1.0.4
type DeferFunc func(*error, ...interface{})
func PinFuncOnce ¶ added in v1.0.4
func PinFuncOnce(ctx context.Context, name string, args ...interface{}) (context.Context, DeferFunc)
*
- PinFuncOnce profile function once
func PinFuncSum ¶ added in v1.0.4
*
- PinFuncSum profile cumulative pefermance function
- @param ctx context.Context
type LocationType ¶
type LocationType C.E_NODE_LOC
/////////////////////////////////////// type LocationType int32
const ( CurrentTraceLoc LocationType = C.E_LOC_CURRENT RootTraceLoc LocationType = C.E_LOC_ROOT )
type PinTransactionHeader ¶ added in v1.0.4
type TRACE_ID_TYPE ¶ added in v1.0.4
type TRACE_ID_TYPE string
///////////////////////////////////////
const ( ROOT_TRACE = 0 TRACE_ID TRACE_ID_TYPE = "__pp_trace_id__" )
type TraceIdType ¶
func GetParentId ¶
func GetParentId(ctx context.Context) (TraceIdType, error)
*
- @description: get parent id ctx from context.Context
- @param {context.Context} ctx
- @return {*}
func Pinpoint_end_trace ¶
func Pinpoint_end_trace(id TraceIdType) TraceIdType
*
- @description: End trace node(id) or trace tree(If current id the root node)
- @param {TraceIdType} id
- @return {*}
func Pinpoint_start_trace ¶
func Pinpoint_start_trace(id TraceIdType) TraceIdType
*
- @description: Create an new trace tree(id=-1) or add a new trace into current trace tree (id>0)
- @param {TraceIdType} id
- @return {*}