pinpoint-apm / pinpoint-go-agent Goto Github PK
View Code? Open in Web Editor NEWPinpoint Go agent
License: Apache License 2.0
Pinpoint Go agent
License: Apache License 2.0
from pinpoint.config
# URLs to exclude from tracing.
# Support ant style pattern. e.g. /aa/*.html, /??/exclude.html
profiler.tomcat.excludeurl=
# HTTP Request methods to exclude from tracing
#profiler.tomcat.excludemethod=POST,PUT
support TLS connection for agent and collector
I can't run on windows.It send me a lot of errors.
go:51:9: undefined: syscall.Getrusage
undefined: syscall.RUSAGE_SELF
undefined: syscall.RUSAGE_SELF
How should I do?
Now, the recovered panic is propagated.
support an option not to propagate recovered panic.
change agent configuration without agent restart
sometimes panic when used in a goroutine scope,
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xad8fe2]
goroutine 6372 [running]:
container/list.(*List).remove(...)
/usr/local/go/src/container/list/list.go:109
container/list.(*List).Remove(...)
/usr/local/go/src/container/list/list.go:141
github.com/pinpoint-apm/pinpoint-go-agent.(*span).EndSpanEvent(0xc00019a3c0)
github.com/pinpoint-apm/pinpoint-go-agent.(*PinpointSqlStmt).QueryContext(0xc001026048, 0x1178040, 0xc001c98ea0, 0xc0015604b0, 0x1, 0x1, 0x40fcb8, 0x10, 0xe785c0, 0x203001)
23
/go/pkg/mod/github.com/pinpoint-apm/[email protected]/sql_driver.go:218 +0x178
from pinpoint.config
# record HTTP request headers case-sensitive
# set to HEADERS-ALL to record all of the request headers including cookie.
# e.g. profiler.http.record.request.headers=X-AccessKey,X-Device-UUID
#profiler.http.record.request.headers=
# record HTTP request cookies(case-sensitive) in Cookie header
# e.g. profiler.http.record.request.cookies=userid,device-id,uuid
#profiler.http.record.request.cookies=
# record HTTP response headers case-sensitive
# set to HEADERS-ALL to record all of the headers.
# e.g. profiler.http.record.response.headers=Set-Cookie
#profiler.http.record.response.headers=
Code overview :
// load DB
import (
"database/sql"
"fmt"
"net/url"
"time"
_ "github.com/pinpoint-apm/pinpoint-go-agent/plugin/pgsql" // use wrapped postgres driver
)
func (conf DBConf) loadDB() *sql.DB {
newDB, err := sql.Open("pq-pinpoint", connectionString)
return newDB
}
`// Code generated by sqlc. DO NOT EDIT.
package postgres
import (
"context"
"database/sql"
)
type DBTX interface {
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
PrepareContext(context.Context, string) (*sql.Stmt, error)
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}
func New(db DBTX) *Queries {
return &Queries{db: db}
}
type Queries struct {
db DBTX
}
func (q *Queries) WithTx(tx *sql.Tx) *Queries {
return &Queries{
db: tx,
}
}
func (q *Queries) QueryGetTbGuestById(ctx context.Context, id string) (TbTransactionDelivery, error) {
row := q.db.QueryRowContext(ctx, queryGetTbGuestById, id)
var i TbTransactionDelivery
err := row.Scan(
&i.Id,
&i.Name,
)
return i, err
}
`
Error :
interface conversion: *pq.conn is not driver.NamedValueChecker: missing method CheckNamedValue"
from pinpoint-root.config
## Call Stack
# Set max depth, if -1 is unlimited and min is 2.
profiler.callstack.max.depth=64
# Profiles
# - -Dpinpoint.profiler.profiles.active=release or local
# - Modify `pinpoint.profiler.profiles.active=release` in $PINPOINT_AGENT_DIR/pinpoint-root.config
# Custom Profile
# - 1. Create a custom profile in $PINPOINT_HOME/profiles/MyProfile
# - Add pinpoint.config & log4j2.xml
# - 2. -Dpinpoint.profiler.profiles.active=MyProfile
# Support external property
# - -Dpinpoint.config=$MY_CONFIG_PATH/pinpoint.config
Event-based applications usually use a consumer group. Currently, it seems that the pinpoint only supports the consumer, but not the consumer group.
If there is a guide, it will be pleasure, and if not, is it okay if I create a PR about this?
grpc client cannot obtain host, but method can be obtained
grpc client无法获取host,但是可以获取到method
extract the goroutine id from the stack trace formatted as text.
need an optimal solution
grpc transporter
Agent
grpc
hope for a gomemcache plugin. Is there any plan~
can not build echo plugin with echo v4 version
Cannot use 'ppecho.WrapHandler(hello)' (type "github.com/labstack/echo".HandlerFunc) as the type "github.com/labstack/echo/v4".HandlerFunc
能否让它在windows运行
build fails on goredis/v7
Cannot use 'ppgoredisv8.NewHook(redisOpts)' (type "github.com/go-redis/redis/v8".Hook) as the type "github.com/go-redis/redis/v7".Hook Type does not implement 'Hook' as some methods are missing: BeforeProcess(ctx context.Context, cmd Cmder) (context.Context, error)
from pinpoint-root.config
# Hide pinpoint headers.
profiler.server.hidepinpointheader=true
from pinpoint-root.config
# Original IP address header. e.g. X-Forwarded-For or X-Real-IP
# https://en.wikipedia.org/wiki/X-Forwarded-For
profiler.server.realipheader=X-Forwarded-For
support option to output logs to the specified file instead of stderr
It returns the wrong handler name from echo and echov4 plugins.
package main
import (
"errors"
"log"
"os"
"github.com/labstack/echo/v4"
"github.com/pinpoint-apm/pinpoint-go-agent"
"github.com/pinpoint-apm/pinpoint-go-agent/plugin/echov4"
)
func hello(c echo.Context) error {
return c.String(200, "Hello World!!")
}
func hello2(c echo.Context) error {
return c.String(200, "Hello World2!!")
}
func myError(c echo.Context) error {
tracer := pinpoint.TracerFromRequestContext(c.Request())
tracer.SpanEvent().SetError(errors.New("my error message"))
return c.String(500, "Error!!")
}
func main() {
opts := []pinpoint.ConfigOption{
pinpoint.WithAppName("GoEchov4Test"),
pinpoint.WithAgentId("GoEchov4TestAgent"),
pinpoint.WithConfigFile(os.Getenv("HOME") + "/tmp/pinpoint-config.yaml"),
}
cfg, _ := pinpoint.NewConfig(opts...)
agent, err := pinpoint.NewAgent(cfg)
if err != nil {
log.Fatalf("pinpoint agent start fail: %v", err)
}
defer agent.Shutdown()
e := echo.New()
e.Use(ppechov4.Middleware())
e.GET("/hello", hello)
e.POST("/hello", hello2)
e.Start(":9000")
}
The handler GET /hello
and POST /hello
will show the same handler name. (either hello or hello2 depending on the order)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.