Giter VIP home page Giter VIP logo

Comments (6)

baskoroaks avatar baskoroaks commented on May 25, 2024

i got same issue
the point is, if query using parameter arguments got failed and return error missing method CheckNamedValue
but, if using query plain without parameter is succeed

from pinpoint-go-agent.

baskoroaks avatar baskoroaks commented on May 25, 2024

how to query using func QueryContext with argument?
i used db.QueryContext(ctx, myQuery, args1, args2)
i still get error *pq.conn is not driver.NamedValueChecker: missing method CheckNamedValue

from pinpoint-go-agent.

dwkang avatar dwkang commented on May 25, 2024

The code that solved the problem was committed to the main branch, and the problem you mentioned do not occur when I test. I think you tested it with the previously released version. Check if you tested it with the main branch.

Or maybe it's because of the go runtime version, but I tested it at 1.18.4. What version did you use?

from pinpoint-go-agent.

baskoroaks avatar baskoroaks commented on May 25, 2024

The code that solved the problem was committed to the main branch, and the problem you mentioned do not occur when I test. I think you tested it with the previously released version. Check if you tested it with the main branch.

Or maybe it's because of the go runtime version, but I tested it at 1.18.4. What version did you use?

I used go 19 version, and i'm still strugling with this errors :D

it's my code, if you can correct my code

`
package main

import (
"context"
"database/sql"
"fmt"
"log"
"net/http"

pinpoint "github.com/pinpoint-apm/pinpoint-go-agent"
phttp "github.com/pinpoint-apm/pinpoint-go-agent/plugin/http"
"github.com/pkg/errors"

_ "github.com/pinpoint-apm/pinpoint-go-agent/plugin/pgsql" // wrap driver psql.

)

const queryG = "select
smc_member,
smc_no_juklak,
sum(smc_star) as star
from star_member_cancel smc
join star_master_expired sme on smc.smc_no_juklak = sme.sme_no_juklak and (now() at time zone 'Asia/Jakarta')::timestamp <= (sme.sme_expired_date at time zone 'Asia/Jakarta')::timestamp
where smc_no_juklak = $1
group by smc_member, smc_no_juklak"

func main() {
opts := []pinpoint.ConfigOption{
pinpoint.WithAppName("test-pinpoint"),
pinpoint.WithAgentId("test-pinpoint-agent"),
pinpoint.WithCollectorHost("pinpoint-host"),
}

cfg, _ := pinpoint.NewConfig(opts...)
agent, err := pinpoint.NewAgent(cfg)
if err != nil {
	log.Fatalf("pinpoint agent start fail=%v", err)
}

http.HandleFunc(phttp.WrapHandleFunc(agent, "query", "/", query))

http.ListenAndServe(":9000", nil)
agent.Shutdown()

}

func query(w http.ResponseWriter, r *http.Request) {
db, err := sql.Open("pq-pinpoint", "postgresql://user:password@host:port/db?sslmode=disable")
if err != nil {
log.Fatalf("error connecting DB =%v", err)
}

defer db.Close()

tracer := pinpoint.TracerFromRequestContext(r)
ctx := pinpoint.NewContext(context.Background(), tracer)

_, err = db.Prepare("select * from star_member_collect where smc_no_juklak=$1")
if err != nil {
	log.Fatalf("err stmt: %v", err)
}

rows, err := db.QueryContext(ctx, queryG, "asdasds")
if err != nil {
	log.Fatalf("sql error: %v", err)
}

var count int

for rows.Next() {
	err = rows.Scan(&count)
	if err != nil && !errors.Is(err, sql.ErrNoRows) {
		log.Fatalf("sql error: %v", err)
	}
}

defer rows.Close()

fmt.Println("number of entries in pg_catalog.pg_tables", count)

}
`

and my pinpoint-go-agent version is v0.5.1

from pinpoint-go-agent.

dwkang avatar dwkang commented on May 25, 2024

There is no problem when I test the go 19 version. Please refer to the link below and test it with the main branch.

https://stackoverflow.com/questions/53682247/how-to-point-go-module-dependency-in-go-mod-to-a-latest-commit-in-a-repo

from pinpoint-go-agent.

baskoroaks avatar baskoroaks commented on May 25, 2024

There is no problem when I test the go 19 version. Please refer to the link below and test it with the main branch.

https://stackoverflow.com/questions/53682247/how-to-point-go-module-dependency-in-go-mod-to-a-latest-commit-in-a-repo

it's solved, thank you for yout advice

from pinpoint-go-agent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.