Skip to content

How do I add a custom detector to allow seamless snowflake integration?  #453

@amanangira

Description

@amanangira

Hello, below are the details of what I am trying to do

import (
    _ "github.com/snowflakedb/gosnowflake" // Snowflake
    "github.com/aws/aws-xray-sdk-go/xray"
    "github.com/jmoiron/sqlx"
)

func main() {
    dsn := ""
    sqlDB, err := xray.SQLContext("snowflake", dsn)
    if err != nil {
        panic(err)
    }
    sqlxDB := sqlx.NewDb(sqlDB, "snowflake")
    rows, rowErr := sqlxDB.QueryContext(context.Background(), "SELECT 1")
    if rowErr != nil {
	panic(rowErr)
    }
}

During debugging the QueryContext context statement I found the below call stack.

Screenshot 2024-02-22 at 4 04 12 PM

Now the problem as per my understanding is that the [newDBAttribute](https://github.com/aws/aws-xray-sdk-go/blob/e9627da6f47902f96f26c577cbe6f9244987a4fb/xray/sql_context.go#L370) call under sql_context.go only seems to be supporting postgres, mysql, and oracle driver types because of which the meta query being fired in case of snowflake is SELECT version(), current_user, current_database() and the Snowflake version() equivalent is [current_version()](https://docs.snowflake.com/en/sql-reference/functions/current_version) which results in some error logs.

Version I am using
go 1.21.0
aws-xray-sdk-go v1.8.3
snowflakedb/gosnowflake v1.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions