Coder Social home page Coder Social logo

instana / go-sensor Goto Github PK

View Code? Open in Web Editor NEW
120.0 42.0 39.0 12.33 MB

:rocket: Go Distributed Tracing & Metrics Sensor for Instana

Home Page: https://www.instana.com/

License: MIT License

Go 97.44% Makefile 0.48% Shell 1.74% Smarty 0.33%
golang go opentracing performance gopher performance-monitoring instrumentation metrics metrics-gathering monitoring

go-sensor's Introduction

IBM Instana Go Tracer

Build Status PkgGoDev OpenTracing Go Report Card

The IBM Instana Go Tracer is an SDK that collects traces, metrics, logs and provides profiling for Go applications. The tracer is part of the IBM Instana Observability tool set.

Compatibility

Tracer Version Go version
v1.62.0 and higher v1.21.0 and higher
v1.47.0 to v1.61.0 v1.13.0 and higher
Less than v1.47.0 v1.9.0 and higher

Note

Make sure to always use the latest version of the tracer, as it provides new features, improvements, security updates and fixes.

Important

Since v1.53.0, the Go Tracer uses fsm v1.0.1 internally. Customers using fsm prior to v1 in their projects will need to update it to v1.

Installation

To add the tracer to your project, run:

go get -u github.com/instana/go-sensor@latest

Note

As a good practice, add this command to your CI pipeline or your automated tool before building the application to keep the tracer up to date.

Usage

Initial Setup

Once the tracer is added to the project, import the package into the entrypoint file of your application:

import (
  ...
  instana "github.com/instana/go-sensor"
)

Create a reference to the collector and initialize it with a service name:

var (
  ...
  col instana.TracerLogger
)

func init() {
  ...
  col = instana.InitCollector(&instana.Options{
    Service: "My app",
  })
}

Note

The tracer expects the Instana Agent to be up and running in the default port 42699. You can change the port with the environment variable INSTANA_AGENT_PORT.

Note

For non default options, like the Agent host and port, the tracer can be configured either via SDK options, environment variables or Agent options.

Collecting Metrics

Once the collector has been initialized with instana.InitCollector, application metrics such as memory, CPU consumption, active goroutine count etc will be automatically collected and reported to the Agent without further actions or configurations to the SDK. This data is then already available in the dashboard.

Tracing Calls

Let's collect traces of calls received by an HTTP server.

Before any changes, your code should look something like this:

// endpointHandler is the standard http.Handler function
http.HandleFunc("/endpoint", endpointHandler)

log.Fatal(http.ListenAndServe(":9090", nil))

Wrap the endpointHandler function with instana.TracingHandlerFunc. Now your code should look like this:

// endpointHandler is now wrapped by `instana.TracingHandlerFunc`
http.HandleFunc("/endpoint", instana.TracingHandlerFunc(col, "/endpoint", endpointHandler))

log.Fatal(http.ListenAndServe(":9090", nil))

When running the application, every time /endpoint is called, the tracer will collect this data and send it to the Instana Agent. You can monitor traces to this endpoint in the Instana UI.

Profiling

Unlike metrics, profiling needs to be enabled with the EnableAutoProfile option, as seen here:

col = instana.InitCollector(&instana.Options{
  Service: "My app",
  EnableAutoProfile: true,
})

You should be able to see your application profiling in the Instana UI under Analytics/Profiles.

Logging

In terms of logging, the SDK provides two distinct logging features:

  1. Traditional logging, that is, logs reported to the standard output, usually used for debugging purposes
  2. Instana logs, a feature that allows customers to report logs to the dashboard under Analytics/Logs

Traditional Logging

Many logs are provided by the SDK, usually prefixed with "INSTANA" and are useful to understand what the tracer is doing underneath. It can also be used for debugging and troubleshoot reasons. Customers can also provide logs by calling one of the following: Collector.Info(), Collector.Warn(), Collector.Error(), Collector.Debug(). You can setup the log level via options or the INSTANA_LOG_LEVEL environment variable.

You can find detailed information in the Instana documentation.

Instana Logs

Instana Logs are spans of the type log.go that are rendered in a special format in the dashboard. You can create logs and report them to the agent or attach them as children of an existing span.

The code snippet below shows how to create logs and send them to the agent:

col := instana.InitCollector(&instana.Options{
  Service: "My Go App",
})

col.StartSpan("log.go", []ot.StartSpanOption{
  ot.Tags{
    "log.level":   "error", // available levels: info, warn, error, debug
    "log.message": "error from log.go span",
  },
}...).Finish() // make sure to "finish" the span, so it's sent to the agent

This log can then be visualized in the dashboard under Analytics/Logs. You can add a filter by service name. In our example, the service name is "My Go App".

Opt-in Exit Spans

Go tracer support the opt-in feature for the exit spans. When enabled, the collector can start capturing exit spans, even without an entry span. This capability is particularly useful for scenarios like cronjobs and other background tasks, enabling the users to tailor the tracing according to their specific requirements. By setting the INSTANA_ALLOW_ROOT_EXIT_SPAN variable, users can choose whether the tracer should start a trace with an exit span or not. The environment variable can have 2 values. (1: Tracer should record exit spans for the outgoing calls, when it has no active entry span. 0 or any other values: Tracer should not start a trace with an exit span).

export INSTANA_ALLOW_ROOT_EXIT_SPAN=1

Complete Example

Basic Usage

package main

import (
  "log"
  "net/http"

  instana "github.com/instana/go-sensor"
)

func main() {
  col := instana.InitCollector(&instana.Options{
    Service:           "Basic Usage",
    EnableAutoProfile: true,
  })

  http.HandleFunc("/endpoint", instana.TracingHandlerFunc(col, "/endpoint", func(w http.ResponseWriter, r *http.Request) {
    w.WriteHeader(http.StatusOK)
  }))

  log.Fatal(http.ListenAndServe(":7070", nil))
}

Wrapping up

Let's quickly summarize what we have seen so far:

  1. We learned how to install, import and initialize the Instana Go Tracer.
  2. Once the tracer is initialized, application metrics are collected out of the box.
  3. Application profiling can be enabled via the EnableAutoProfile option.
  4. Tracing incoming HTTP requests by wrapping the Go standard library http.Handler with instana.TracingHandlerFunc.

With this knowledge it's already possible to make your Go application traceable by our SDK. But there is much more you can do to enhance tracing for your application.

The basic functionality covers tracing for the following standard Go features:

  1. HTTP incoming requests
  2. HTTP outgoing requests
  3. SQL drivers

As we already covered HTTP incoming requests, we suggest that you understand how to collect data from HTTP outgoing requests and SQL driver databases.

Another interesting feature is the usage of additional packages located under instrumentation. Each of these packages provide tracing for specific Go packages like the AWS SDK, Gorm and Fiber.

What's Next

  1. Tracer Options
  2. Tracing HTTP Outgoing Requests
  3. Tracing SQL Driver Databases
  4. Tracing an application running on Azure Container Apps
  5. Tracing Other Go Packages
  6. Instrumenting Code Manually

go-sensor's People

Contributors

andrewslotin avatar angith avatar atleanix avatar basti1302 avatar benjaminwardemannibm avatar boyand avatar dependabot[bot] avatar dmelikyan avatar doertedev-instana avatar ferenc- avatar github-actions[bot] avatar jborut avatar jsageryd avatar jw-s avatar mier85 avatar mmlb avatar nickhstr avatar nithinputhenveettil avatar noctarius avatar pavlobaron avatar pglombardo avatar sanojsubran avatar steveww avatar vincent-pli avatar willianpc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-sensor's Issues

Needed: A better logging strategy

Pointed out by @monolovl in #2 the logging could be improved in this package.

To be consistent with our other languages we need a logger that:

  1. Supports Debug/Warn/Info/Fatal levels
  2. Configurable in-code & replaceable by app logger
  3. Configurable via environment variables
  4. Defaults to stdout/stderr but configurable
  5. Messages prefixed with [instana] or equivalent

General goal for instrumentation is to:

  1. Boot a single boot message and not print anything else if all goes well
  2. In case of error, print a single error and handle in best case
  3. If handling is not possible, deactivate the sensor and sit in a corner

[Bug]: SQL instrumentation - DB connection parsing

Problem Description

While opening the database connection Instana will try to detect the connection string format for some specific parsing. There're scenarios where the connection string is matching the URI strategy when it shouldn't.

That happens because the scheme could be wrongly populated by something that is not actually a scheme. My suggestion is to also check if the u.Path is empty here to avoid the panic some lines below.

Minimal, Complete, Verifiable, Example

The following connection string is matching as a URI:

user:secret@tcp(example.com:3306)/database_name?interpolateParams=true&autocommit=true&parseTime=true&charset=utf8mb4,utf8

https://go.dev/play/p/wusxyfBjPvb

image

Go Version

go1.18

go.mod

github.com/instana/go-sensor v1.42.1
github.com/instana/go-sensor/instrumentation/instaecho v1.1.1
github.com/instana/go-sensor/instrumentation/instagrpc v1.1.0
github.com/instana/go-sensor/instrumentation/instalogrus v1.0.0

go env

Not necessary.

Go modules support

Go modules expects tags to be in vX.Y.Z format. Currently they are in X.Y.Z format, lacking the first v.
It's a one character change and you get go mod support for free.

[Bug]: SQLGetDiagRec error when instrumenting Db2 created with sql.Open()

Problem Description

Dear team,

As the doc mentioned in https://www.ibm.com/docs/en/instana-observability/225?topic=go-collector-common-operations#how-to-instrument-a-database-connection-created-with-sqlopen , it could instrument a database connection created with sql.Open().

And then I followed the instruction to do it as below,

`	// Create a new instana.Sensor instance
sensor := instana.NewSensor("dv-api-instana-db")

// Instrument the driver
instana.InstrumentSQLDriver(sensor, "go_ibm_db", &db2.Driver{})

// Create an instance of *sql.DB to use for database queries
db, err := instana.SQLOpen("go_ibm_db", con)`

But the test failed with error "SQLGetDiagRec failed: ret=-2".
I debugged the code and found go-sensor could not work properly with Db2 Go driver implementation go_ibm_db (https://github.com/ibmdb/go_ibm_db)

go-sensor will register a driver named as XXX_with_instana, and then when instana.SQLOpen(), it will also look up the driver name with suffix "_with_instana". In my case, the driver name is go_ibm_db__with_instana.

Looking at the code in https://github.com/ibmdb/go_ibm_db/blob/f4db66e52b44096ec048ffb01e8932712a4c9c74/driver.go#L23, when initializing/register a driver, there are extra steps. This might be the reason why the registered driver go_ibm_db__with_instana could not work properly with go_ibm_db.

Can you please have a check and make a plan to support go_ibm_db?


Or at least a change to

func SQLOpen(driverName, dataSourceName string) (*sql.DB, error) {
, in the SQLOpen function, there is a step to always add a suffix "_with_instana".

func SQLOpen(driverName, dataSourceName string) (*sql.DB, error) {

	if !strings.HasSuffix(driverName, "_with_instana") {
		driverName += "_with_instana"
	}

	return sql.Open(driverName, dataSourceName)
}

Actually in go_ibm_db, it will register a driver with the original name, 'go_ibm_db' in this case. So when running sql.Open("go_ibm_db", dataSourceName), it does work( by commenting the lines as below). This is a local test only. I don't know if all the other functions work or not.

	//if !strings.HasSuffix(driverName, "_with_instana") {
	//	driverName += "_with_instana"
	//}

I am thinking if a parameter added to SQLOpen(), to add an option if a suffix is added to the original driver name.

Minimal, Complete, Verifiable, Example

No response

Go Version

go 1.18.5

go.mod

github.com/ibmdb/go_ibm_db v0.4.1
github.com/instana/go-sensor v1.43.4

go env

N/A

instaredis is not compatible with go-redis/v9

Problem Description

instaredis documentation states that it is compatible with go-redis client, however upon initialization, I get the following type mismatch error:

Screenshot 2023-01-26 at 3 32 03 PM

Since we're using Redis 7, we cannot use v8 for go-redis.

Minimal, Complete, Verifiable, Example

Below snippet won't build as the client passed in doesn't match the expected interface

import (
         instana "github.com/instana/go-sensor"
	"github.com/instana/go-sensor/instrumentation/instaredis"
	"github.com/redis/go-redis/v9"
)

func main() {
 sensor := instana.NewSensor("test-app-tracing") 
 client := redis.NewClient(&redis.Options{
			Addr:     "localhost:6379",
			Password: "12345",
			DB:       0,
		})
      )
 instaredis.WrapClient(client, sensor)
}

Go Version

1.19

go.mod

github.com/instana/go-sensor/instrumentation/instaredis v1.4.0
	github.com/redis/go-redis/v9 v9.0.0-rc.4
	github.com/instana/go-sensor v1.49.0


	github.com/go-redis/redis/v8 v8.11.4 // indirect

go env

N/A

net.Dial timeouts and connection errors are not handled correctly

If an error is returned by net.Dial, we need fix our handling:
https://github.com/instana/golang-sensor/blob/master/fsm.go#L140-L142

In case of an error, the instrumentation can panic:

March 28th 2017, 08:28:07.709   goroutine 1011375 [running]:
March 28th 2017, 08:28:07.709   
March 28th 2017, 08:28:07.709   panic(0x9d3ea0, 0xc420497580)
March 28th 2017, 08:28:07.709   panic: interface conversion: net.Conn is nil, not *net.TCPConn

cc: @codec

[Bug]: INSTANA_EXTRA_HTTP_HEADERS does nothing

Problem Description

Observed:
I set INSTANA_EXTRA_HTTP_HEADERS for my go-service to some value to collect additional headers, but it had no effect. Looking at
https://github.com/instana/go-sensor/blob/master/agent.go#L367 it believe it is override by whatever the Agent send.

Expected:
Headers set in INSTANA_EXTRA_HTTP_HEADERS are collected.

Minimal, Complete, Verifiable, Example

No response

Go Version

1.16

go.mod

I don't think this is necessary

go env

I don't think this is necessary

[Bug]: ContextWithSpan / SpanFromContext not interoperable with opentracing

Problem Description

instana.ContextWithSpan (and SpanFromContext) use their own context-key to store the current span in context.

As a result http handlers wrapped in instana.TracingNamedHandlerFunc (or derivates) can not find Instanas Span using opentracing.SpanFromContext.

I think it would be better to use the corresponding opentracing functions (https://github.com/opentracing/opentracing-go/blob/master/gocontext.go#L11) so that instana Spans can be retrieved (and augmented) by any client using opentracing-go.

Minimal, Complete, Verifiable, Example

Go Version

go1.18

go.mod

-

go env

-

[Bug]: sql instrumentation broken for postgres since v1.45.0

Problem Description

The sql instrumentation for the postgres driver is broken since v1.45.0.

I believe that the reason is the changes made on this PR.

It is not reaching the defaultCheckNamedValue anymore here.

Then we get an error anytime we use a type that is not supported out of the box by the driver.

One example is with the int32 type:

pq: encode: unknown type for int32

With the version v1.44.0 it works.

Minimal, Complete, Verifiable, Example

package main

import (
	"fmt"
	"log"

	instana "github.com/instana/go-sensor"
	"github.com/lib/pq"
)

// go mod init instanaproblem
// go mod tidy
// docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_DB=mydb -d postgres

// run 1
// go get github.com/instana/[email protected]
// go mod tidy
// go run main.go
// output: {0x14000332090 1} <nil>

// run 2
// go get github.com/instana/[email protected]
// go mod tidy
// go run main.go
// output: <nil> pq: encode: unknown type for int32

func main() {
	tracer := instana.NewTracerWithOptions(&instana.Options{
		Service: "some-service",
	})
	sensor := instana.NewSensorWithTracer(tracer)
	instana.InstrumentSQLDriver(sensor, "postgres", &pq.Driver{})

	db, err := instana.SQLOpen("postgres", "host=localhost port=5432 user=postgres password=mysecretpassword dbname=mydb sslmode=disable")
	if err != nil {
		log.Fatalf("Could not connect to postgres DB: %v\n", err)
	}

	result, err := db.Exec("select $1", int32(1))
	fmt.Println(result, err)
}

Go Version

go1.19.3

go.mod

module instanaproblem

go 1.19

require (
	github.com/instana/go-sensor v1.45.0
	github.com/lib/pq v1.10.7
)

require (
	github.com/looplab/fsm v0.1.0 // indirect
	github.com/opentracing/opentracing-go v1.1.0 // indirect
)

go env

GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="############/Library/Caches/go-build"
GOENV="############/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="############/go/pkg/mod"
GONOPROXY="###############################"
GONOSUMDB="######################"
GOOS="darwin"
GOPATH="##################/go"
GOPRIVATE="#########################"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.19.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.19.3/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="######################/instanabug/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4m/_8ntf1ld0794rhf5t4_bdkkc0000gq/T/go-build853762334=/tmp/go-build -gno-record-gcc-switches -fno-common"

[Bug]: sql: converting argument $2 type: unsupported type sql.Out, a struct when instrumenting Db2

Problem Description

When enabling Instana monitor on Dd2 , there is error return when calling Store Procedure with OUT parameter, for example,

_, dbErr := db.Exec(sqlString, sql.Out{Dest: &returnValue})

It does work when disabling Instana and there is no error returned.

The instrument done as follwing,

// Create a new instana.Sensor instance
sensor := instana.NewSensor("dv-api-instana-db")

// Create an instance of *sql.DB to use for database queries
db, err := instana.SQLInstrumentAndOpen(sensor, "go_ibm_db", con)

Minimal, Complete, Verifiable, Example

No response

Go Version

go.1.19, go 1.18.5

go.mod

github.com/ibmdb/go_ibm_db v0.4.1
github.com/instana/go-sensor v1.43.4

go env

N/A

Viewing examples on dashboard

Hi,

I'm having issues getting trace metadata into Instana, or finding it on the dashboard.
I've tried the go-sensor examples,

https://github.com/instana/go-sensor/blob/master/example/ot-simple/simple.go
https://github.com/instana/go-sensor/blob/master/example/rpc/rpc.go

I can get the calls coming through to the Instana dashboard and the services show up as I would expect. There's just no detail on the traces. Span names, any tags, log fields etc don't seem to be anywhere.

For ot-simple:

  • The name of the endpoint is "GET /golang" for ot-simple (where does this come from?)
  • Where is the span name displayed? "asteroid" in this case
  • Where are the tags? (Component, Url, Method,)
  • Where are the log fields?

For rpc:

  • The endpoint name is "Internal trigger"
  • Where are the endpoints parentService.myCoolMethod and childService.anotherCoolMethod?

thanks!

Documentation: Describe Event severity

We offer SendServiceEvent and ServeHostEvent as part of the event API but we don't adequetly explain the severity value. We shoud put in a short code comment and update the READE with a link to the documentation.

Severity is an optional integer of -1, 5 and 10. A value of -1 or EMPTY will generate a Change. A value of 5 will generate a warning Issue and a value of 10 will generate a critical Issue.

  • Code comments; short explanation
  • Update & expand README Event API section
  • Add Constants to represent severity levels (see comment below)

[Bug]: go mod tidy fails when using the latest google.golang.org/grpc

Problem Description

The package google.golang.org/grpc/test/grpc_testing was moved to google.golang.org/grpc/interop/grpc_testing in google.golang.org/grpc v1.55.0 - this is stopping us from using the latest google.golang.org/grpc.

When we run go mod tidy we get the following error:

go mod tidy
go: finding module for package google.golang.org/grpc/test/grpc_testing
go: github.ibm.com/WML/watsonx-inference-proxy/internal/common/grpc imports
	github.com/instana/go-sensor/instrumentation/instagrpc tested by
	github.com/instana/go-sensor/instrumentation/instagrpc.test imports
	google.golang.org/grpc/test/grpc_testing: module google.golang.org/grpc@latest found (v1.59.0), but does not contain package google.golang.org/grpc/test/grpc_testing

Minimal, Complete, Verifiable, Example

Normally any project that has a go.mod that contains this will fail:

require (
	github.com/instana/go-sensor v1.58.0
	github.com/instana/go-sensor/instrumentation/instagrpc v1.10.0
	google.golang.org/grpc v1.59.0

Go Version

go1.21.3

go.mod

go 1.21

require (
	dario.cat/mergo v1.0.0
	github.com/IBM-Cloud/bluemix-go v0.0.0-20230616121711-b838ccdcd2fb
	github.com/IBM/sarama v1.41.3
	github.com/Jeffail/gabs/v2 v2.7.0
	github.com/alevinval/sse v1.0.1
	github.com/allegro/bigcache/v3 v3.1.0
	github.com/buaazp/fasthttprouter v0.1.1
	github.com/cucumber/godog v0.13.0
	github.com/go-logr/zapr v1.2.4
	github.com/go-redis/redis_rate/v10 v10.0.1
	github.com/google/uuid v1.3.1
	github.com/gorilla/mux v1.8.0
	github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf
	github.com/instana/go-sensor v1.58.0
	github.com/instana/go-sensor/instrumentation/instagrpc v1.10.0
	github.com/nicksnyder/go-i18n/v2 v2.2.1
	github.com/onsi/ginkgo/v2 v2.13.0
	github.com/onsi/gomega v1.28.0
	github.com/opentracing/opentracing-go v1.2.0
	github.com/prometheus/client_golang v1.17.0
	github.com/rabbitmq/amqp091-go v1.9.0
	github.com/redis/go-redis/v9 v9.2.1
	github.com/segmentio/analytics-go/v3 v3.2.1
	github.com/spf13/pflag v1.0.5
	github.com/spf13/viper v1.17.0
	github.com/valyala/fasthttp v1.50.0
	github.com/xeipuuv/gojsonschema v1.2.0
	github.ibm.com/WML/utils-lib-go v1.0.467
	go.uber.org/zap v1.26.0
	golang.org/x/exp v0.0.0-20231006140011-7918f672742d
	golang.org/x/text v0.13.0
	golang.org/x/time v0.3.0
	google.golang.org/grpc v1.59.0
	google.golang.org/protobuf v1.31.0
	gopkg.in/yaml.v2 v2.4.0
	k8s.io/client-go v0.28.2
)

require github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect

require (
	github.com/andybalholm/brotli v1.0.6 // indirect
	github.com/beorn7/perks v1.0.1 // indirect
	github.com/cespare/xxhash/v2 v2.2.0 // indirect
	github.com/cristalhq/jwt/v5 v5.1.0 // indirect
	github.com/cucumber/gherkin-go/v19 v19.0.3 // indirect
	github.com/cucumber/messages-go/v16 v16.0.1 // indirect
	github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
	github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
	github.com/eapache/go-resiliency v1.4.0 // indirect
	github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
	github.com/eapache/queue v1.1.0 // indirect
	github.com/fsnotify/fsnotify v1.6.0 // indirect
	github.com/gabriel-vasile/mimetype v1.4.3 // indirect
	github.com/go-logr/logr v1.2.4 // indirect
	github.com/go-playground/locales v0.14.1 // indirect
	github.com/go-playground/universal-translator v0.18.1 // indirect
	github.com/go-playground/validator/v10 v10.15.5
	github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
	github.com/goccy/go-json v0.10.2 // indirect
	github.com/gofrs/uuid v4.4.0+incompatible // indirect
	github.com/golang/protobuf v1.5.3 // indirect
	github.com/golang/snappy v0.0.4 // indirect
	github.com/google/go-cmp v0.6.0 // indirect
	github.com/google/pprof v0.0.0-20230926050212-f7f687d19a98 // indirect
	github.com/hashicorp/errwrap v1.1.0 // indirect
	github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
	github.com/hashicorp/go-memdb v1.3.4 // indirect
	github.com/hashicorp/go-multierror v1.1.1 // indirect
	github.com/hashicorp/go-uuid v1.0.3 // indirect
	github.com/hashicorp/golang-lru v1.0.2
	github.com/hashicorp/hcl v1.0.0 // indirect
	github.com/jcmturner/aescts/v2 v2.0.0 // indirect
	github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
	github.com/jcmturner/gofork v1.7.6 // indirect
	github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
	github.com/jcmturner/rpc/v2 v2.0.3 // indirect
	github.com/klauspost/compress v1.17.1 // indirect
	github.com/leodido/go-urn v1.2.4 // indirect
	github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
	github.com/lestrrat-go/blackmagic v1.0.2 // indirect
	github.com/lestrrat-go/httpcc v1.0.1 // indirect
	github.com/lestrrat-go/iter v1.0.2 // indirect
	github.com/lestrrat-go/jwx v1.2.26 // indirect
	github.com/lestrrat-go/option v1.0.1 // indirect
	github.com/linkedin/goavro/v2 v2.12.0 // indirect
	github.com/looplab/fsm v1.0.1 // indirect
	github.com/magiconair/properties v1.8.7 // indirect
	github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
	github.com/mitchellh/mapstructure v1.5.0 // indirect
	github.com/pelletier/go-toml/v2 v2.1.0 // indirect
	github.com/pierrec/lz4/v4 v4.1.18 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/prometheus/client_model v0.5.0 // indirect
	github.com/prometheus/common v0.45.0 // indirect
	github.com/prometheus/procfs v0.12.0 // indirect
	github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
	github.com/sagikazarmark/locafero v0.3.0 // indirect
	github.com/sagikazarmark/slog-shim v0.1.0 // indirect
	github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
	github.com/segmentio/backo-go v1.0.1 // indirect
	github.com/sourcegraph/conc v0.3.0 // indirect
	github.com/spf13/afero v1.10.0 // indirect
	github.com/spf13/cast v1.5.1 // indirect
	github.com/subosito/gotenv v1.6.0 // indirect
	github.com/valyala/bytebufferpool v1.0.0 // indirect
	github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
	github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
	go.uber.org/multierr v1.11.0 // indirect
	golang.org/x/crypto v0.14.0 // indirect
	golang.org/x/net v0.17.0 // indirect
	golang.org/x/sys v0.13.0 // indirect
	golang.org/x/tools v0.14.0 // indirect
	google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
	gopkg.in/ini.v1 v1.67.0 // indirect
	gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
	gopkg.in/yaml.v3 v3.0.1 // indirect
	k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
)

exclude (
	// exclude these until fixed in instana
	google.golang.org/grpc v1.55.0
	google.golang.org/grpc v1.55.1
	google.golang.org/grpc v1.56.0
	google.golang.org/grpc v1.56.1
	google.golang.org/grpc v1.56.2
	google.golang.org/grpc v1.56.3
	google.golang.org/grpc v1.57.0
	google.golang.org/grpc v1.57.1
	google.golang.org/grpc v1.58.0
	google.golang.org/grpc v1.58.1
	google.golang.org/grpc v1.58.2
	google.golang.org/grpc v1.58.3
)

go env

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/julianpayne/Library/Caches/go-build'
GOENV='/Users/julianpayne/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/julianpayne/go/pkg/mod'
GONOPROXY=''
GONOSUMDB='github.ibm.com/*'
GOOS='darwin'
GOPATH='/Users/julianpayne/go'
GOPRIVATE=''
GOPROXY='https://[email protected]:cmVmdGtuOjAxOjE2OTc5ODA3Mzc6ZWhMaENFWnp0T1hxdFRQRzRqeFAwQ3phbzFY@na.artifactory.swg-devops.com/artifactory/api/go/hyc-wml-devops-team-repository-go-virtual'
GOROOT='/opt/homebrew/Cellar/go/1.21.3/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.3/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.3'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/julianpayne/vscode/watsonx-inference-proxy/go.mod'
GOWORK='/Users/julianpayne/vscode/go.work'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/jc/69m4y73s6gsd5g6mk7ydnpv80000gn/T/go-build2835764399=/tmp/go-build -gno-record-gcc-switches -fno-common'

Add example of how to capture HTTP headers

The example for instrumenting the WebServer should also show how to capture and send to the Instana backends HTTP headers that would be found using the call.http.header filter.

Suggestion: Use x-instana-l for sampling

Hi,

in propagation.go SpanContext.Sampled is always set to false. There is still a todo add configurable sampling strategy.
https://github.com/instana/golang-sensor/blob/dd3b6b166b5c5a4527ea0317bc470c36e22054ca/propagation.go#L145

I asked myself why you don't inject "1" as trace level if SpanContext.Sampled is true and "0" if it is false.
https://github.com/instana/golang-sensor/blob/dd3b6b166b5c5a4527ea0317bc470c36e22054ca/propagation.go#L78

Then you could extract the level and use it to determine if you should set SpanContext.Sampled to true or false.

I think this behavior is backed by the instana documentation:
x-instana-l carries information about the trace level, where 0 means that no trace shall be recorded.
https://instana.atlassian.net/wiki/display/DOCS/Instana+Trace+Model

PSanetra

test flaky because of race condition

sometimes running the tests fails because of a race condition :

WARNING: DATA RACE
Read at 0x00c42014e008 by goroutine 8:
  github.com/mier85/golang-sensor.(*agentS).fullRequestResponse()
      /home/michi/go/src/github.com/mier85/golang-sensor/agent.go:148 +0x103
  github.com/mier85/golang-sensor.(*agentS).requestHeader()
      /home/michi/go/src/github.com/mier85/golang-sensor/agent.go:98 +0xab
  github.com/mier85/golang-sensor.(*fsmS).checkHost()
      /home/michi/go/src/github.com/mier85/golang-sensor/fsm.go:100 +0x1f7

Previous write at 0x00c42014e008 by goroutine 7:
  github.com/mier85/golang-sensor.(*sensorS).init()
      /home/michi/go/src/github.com/mier85/golang-sensor/sensor.go:27 +0x152
  github.com/mier85/golang-sensor.InitSensor()
      /home/michi/go/src/github.com/mier85/golang-sensor/sensor.go:73 +0x18c
  github.com/mier85/golang-sensor.sendEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:74 +0x1b9
  github.com/mier85/golang-sensor.SendServiceEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:48 +0x1b2
  github.com/mier85/golang-sensor.SendDefaultServiceEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:40 +0x122
  github.com/mier85/golang-sensor.TestEventDefault()
      /home/michi/go/src/github.com/mier85/golang-sensor/event_internal_test.go:16 +0x70
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:777 +0x16d

Goroutine 8 (running) created at:
  github.com/mier85/golang-sensor.(*fsmS).lookupAgentHost()
      /home/michi/go/src/github.com/mier85/golang-sensor/fsm.go:85 +0x20c
  github.com/mier85/golang-sensor.(*fsmS).(github.com/mier85/golang-sensor.lookupAgentHost)-fm()
      /home/michi/go/src/github.com/mier85/golang-sensor/fsm.go:44 +0x4b
  github.com/looplab/fsm.(*FSM).enterStateCallbacks()
      /home/michi/go/src/github.com/looplab/fsm/fsm.go:389 +0x19c
  github.com/looplab/fsm.(*FSM).Event.func1()
      /home/michi/go/src/github.com/looplab/fsm/fsm.go:294 +0xc4
  github.com/looplab/fsm.transitionerStruct.transition()
      /home/michi/go/src/github.com/looplab/fsm/fsm.go:340 +0x6f
  github.com/looplab/fsm.(*transitionerStruct).transition()
      <autogenerated>:1 +0x4b
  github.com/looplab/fsm.(*FSM).doTransition()
      /home/michi/go/src/github.com/looplab/fsm/fsm.go:325 +0x5c
  github.com/looplab/fsm.(*FSM).Event()
      /home/michi/go/src/github.com/looplab/fsm/fsm.go:307 +0x5d6
  github.com/mier85/golang-sensor.(*fsmS).init()
      /home/michi/go/src/github.com/mier85/golang-sensor/fsm.go:49 +0x775
  github.com/mier85/golang-sensor.(*agentS).initFsm()
      /home/michi/go/src/github.com/mier85/golang-sensor/fsm.go:205 +0x71
  github.com/mier85/golang-sensor.(*agentS).init()
      /home/michi/go/src/github.com/mier85/golang-sensor/agent.go:51 +0xd9
  github.com/mier85/golang-sensor.(*sensorS).initAgent()
      /home/michi/go/src/github.com/mier85/golang-sensor/agent.go:174 +0xdb
  github.com/mier85/golang-sensor.(*sensorS).init()
      /home/michi/go/src/github.com/mier85/golang-sensor/sensor.go:27 +0x131
  github.com/mier85/golang-sensor.InitSensor()
      /home/michi/go/src/github.com/mier85/golang-sensor/sensor.go:73 +0x18c
  github.com/mier85/golang-sensor.sendEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:74 +0x1b9
  github.com/mier85/golang-sensor.SendServiceEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:48 +0x1b2
  github.com/mier85/golang-sensor.SendDefaultServiceEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:40 +0x122
  github.com/mier85/golang-sensor.TestEventDefault()
      /home/michi/go/src/github.com/mier85/golang-sensor/event_internal_test.go:16 +0x70
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:777 +0x16d

Goroutine 7 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:824 +0x564
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1063 +0xa4
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:777 +0x16d
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1061 +0x4e1
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:978 +0x2cd
  main.main()
      _testmain.go:100 +0x22a
==================
==================
WARNING: DATA RACE
Read at 0x00c42014e038 by goroutine 8:
  github.com/mier85/golang-sensor.(*agentS).fullRequestResponse()
      /home/michi/go/src/github.com/mier85/golang-sensor/agent.go:148 +0x11f
  github.com/mier85/golang-sensor.(*agentS).requestHeader()
      /home/michi/go/src/github.com/mier85/golang-sensor/agent.go:98 +0xab
  github.com/mier85/golang-sensor.(*fsmS).checkHost()
      /home/michi/go/src/github.com/mier85/golang-sensor/fsm.go:100 +0x1f7

Previous write at 0x00c42014e038 by goroutine 7:
  github.com/mier85/golang-sensor.(*agentS).init()
      /home/michi/go/src/github.com/mier85/golang-sensor/agent.go:51 +0xfa
  github.com/mier85/golang-sensor.(*sensorS).initAgent()
      /home/michi/go/src/github.com/mier85/golang-sensor/agent.go:174 +0xdb
  github.com/mier85/golang-sensor.(*sensorS).init()
      /home/michi/go/src/github.com/mier85/golang-sensor/sensor.go:27 +0x131
  github.com/mier85/golang-sensor.InitSensor()
      /home/michi/go/src/github.com/mier85/golang-sensor/sensor.go:73 +0x18c
  github.com/mier85/golang-sensor.sendEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:74 +0x1b9
  github.com/mier85/golang-sensor.SendServiceEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:48 +0x1b2
  github.com/mier85/golang-sensor.SendDefaultServiceEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:40 +0x122
  github.com/mier85/golang-sensor.TestEventDefault()
      /home/michi/go/src/github.com/mier85/golang-sensor/event_internal_test.go:16 +0x70
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:777 +0x16d

Goroutine 8 (running) created at:
  github.com/mier85/golang-sensor.(*fsmS).lookupAgentHost()
      /home/michi/go/src/github.com/mier85/golang-sensor/fsm.go:85 +0x20c
  github.com/mier85/golang-sensor.(*fsmS).(github.com/mier85/golang-sensor.lookupAgentHost)-fm()
      /home/michi/go/src/github.com/mier85/golang-sensor/fsm.go:44 +0x4b
  github.com/looplab/fsm.(*FSM).enterStateCallbacks()
      /home/michi/go/src/github.com/looplab/fsm/fsm.go:389 +0x19c
  github.com/looplab/fsm.(*FSM).Event.func1()
      /home/michi/go/src/github.com/looplab/fsm/fsm.go:294 +0xc4
  github.com/looplab/fsm.transitionerStruct.transition()
      /home/michi/go/src/github.com/looplab/fsm/fsm.go:340 +0x6f
  github.com/looplab/fsm.(*transitionerStruct).transition()
      <autogenerated>:1 +0x4b
  github.com/looplab/fsm.(*FSM).doTransition()
      /home/michi/go/src/github.com/looplab/fsm/fsm.go:325 +0x5c
  github.com/looplab/fsm.(*FSM).Event()
      /home/michi/go/src/github.com/looplab/fsm/fsm.go:307 +0x5d6
  github.com/mier85/golang-sensor.(*fsmS).init()
      /home/michi/go/src/github.com/mier85/golang-sensor/fsm.go:49 +0x775
  github.com/mier85/golang-sensor.(*agentS).initFsm()
      /home/michi/go/src/github.com/mier85/golang-sensor/fsm.go:205 +0x71
  github.com/mier85/golang-sensor.(*agentS).init()
      /home/michi/go/src/github.com/mier85/golang-sensor/agent.go:51 +0xd9
  github.com/mier85/golang-sensor.(*sensorS).initAgent()
      /home/michi/go/src/github.com/mier85/golang-sensor/agent.go:174 +0xdb
  github.com/mier85/golang-sensor.(*sensorS).init()
      /home/michi/go/src/github.com/mier85/golang-sensor/sensor.go:27 +0x131
  github.com/mier85/golang-sensor.InitSensor()
      /home/michi/go/src/github.com/mier85/golang-sensor/sensor.go:73 +0x18c
  github.com/mier85/golang-sensor.sendEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:74 +0x1b9
  github.com/mier85/golang-sensor.SendServiceEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:48 +0x1b2
  github.com/mier85/golang-sensor.SendDefaultServiceEvent()
      /home/michi/go/src/github.com/mier85/golang-sensor/event.go:40 +0x122
  github.com/mier85/golang-sensor.TestEventDefault()
      /home/michi/go/src/github.com/mier85/golang-sensor/event_internal_test.go:16 +0x70
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:777 +0x16d

Goroutine 7 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:824 +0x564
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1063 +0xa4
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:777 +0x16d
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1061 +0x4e1
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:978 +0x2cd
  main.main()
      _testmain.go:100 +0x22a
==================
--- FAIL: TestEventDefault (0.00s)
	testing.go:730: race detected during execution of test
2018/05/04 10:55:12 ERROR: instana: Cannot connect to the agent through localhost or default gateway. Scheduling retry.
2018/05/04 10:55:12 DEBUG: instana: initializing agent
2018/05/04 10:55:12 WARN: instana: Stan is on the scene.  Starting Instana instrumentation.
2018/05/04 10:55:12 DEBUG: instana: initializing fsm
2018/05/04 10:55:12 DEBUG: instana: initializing meter
2018/05/04 10:55:12 DEBUG: instana: checking host localhost
2018/05/04 10:55:12 DEBUG: instana: initialized sensor
2018/05/04 10:55:12 INFO: instana: Get http://localhost:42699/: dial tcp 127.0.0.1:42699: connect: connection refused http://localhost:42699/
2018/05/04 10:55:12 DEBUG: instana: checking default gateway 172.16.255.254
FAIL
exit status 1
FAIL	github.com/mier85/golang-sensor	0.258s
``

Logging warn and error when using open tracing

I'm using the go sensor with open tracing. Everything works OK apart from logging an error.

What are the magic tags I need to set to generate a log message so that it shows up under the service log messages?

Initialize Tracer with common tags ...

If I want to to tag all the spans with static metadata of microservice (e.g. hostname or other logical naming things) , it will be very helpful if I can just set that at tracer initialization time, rather than send that on every span as tag.

Handle case sensitive headers for trace propagation

Currently the instana headers are injected lowercase by the carrier implementation. We see problems with this when we deal with child spans between services. The default HTTP implementation in Go would convert any first letter to uppercase https://github.com/golang/go/blob/master/src/net/textproto/reader.go#L554.

Therefore as we read headers from the wire and move them within a context through the service, we may end up with a mixture of uppercase and lowercase headers before the request to the next service is sent. This may often lead to loss of the child span.

Example:

        WIRE      |        READ        |      INJECT
   x-instana-t 1  |  X-Instana-T 1      |   X-Instana-T 1
   x-instana-s 1  |  X-Instana-S 1      |   X-Instana-S 1
                                            x-instana-t 1
                                            x-instana-s 2

[Bug]: go-sensor uses an old github.com/looplab/fsm v0.1.0 and conflicts for the module which uses latest go-sensor and latest looplab/fsm

Problem Description

  • go-sensor uses an old github.com/looplab/fsm v0.1.0 and conflicts for the module, which uses the latest go-sensor and the latest looplab/fsm
# github.com/instana/go-sensor
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:68:25: cannot use ret.lookupAgentHost (value of type func(e *fsm.Event)) as type fsm.Callback in map literal
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:69:25: cannot use ret.announceSensor (value of type func(e *fsm.Event)) as type fsm.Callback in map literal
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:70:25: cannot use ret.testAgent (value of type func(e *fsm.Event)) as type fsm.Callback in map literal
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:71:25: cannot use ret.ready (value of type func(e *fsm.Event)) as type fsm.Callback in map literal
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:73:16: not enough arguments in call to ret.fsm.Event
        have (string)
        want (context.Context, string, ...interface{})
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:149:14: not enough arguments in call to r.fsm.Event
        have (string)
        want (context.Context, string, ...interface{})
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:156:15: not enough arguments in call to r.fsm.Event
        have (string)
        want (context.Context, string, ...interface{})
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:209:15: not enough arguments in call to r.fsm.Event
        have (string)
        want (context.Context, string, ...interface{})
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:268:15: not enough arguments in call to r.fsm.Event
        have (string)
        want (context.Context, string, ...interface{})
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:274:14: not enough arguments in call to r.fsm.Event
        have (string)
        want (context.Context, string, ...interface{})
../../.go/pkg/mod/github.com/instana/[email protected]/fsm.go:274:14: too many errors

Minimal, Complete, Verifiable, Example

go get -u .../
go mod tidy
go test

Go Version

go 1.19

go.mod

module github.ibm.com/xxx/yyy

go 1.19


require (
   require github.com/looplab/fsm v1.0.1
)

go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/asrath/.cache/go-build"
GOENV="/home/asrath/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/asrath/.go/pkg/mod"
GONOPROXY="github.ibm.com"
GONOSUMDB="github.ibm.com"
GOOS="linux"
GOPATH="/home/asrath/.go"
GOPRIVATE="github.ibm.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/asrath/repo/gw-deploy/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build969956151=/tmp/go-build -gno-record-gcc-switches"

Span is only forwarding error log records to agent

The sendOpenTracingLogRecords method in span.go is excluding log records that are not errors when forwarding log records to the agent.
We would like this filter removed so we can send other types of log records (info and warning) to Instana. If it makes sense I can create a PR with the proposed change.

The test for autoprofile.Timer is flaky

The following tests in autoprofile occasionally fail due to a timing issue causing CI to mark builds as red:

--- FAIL: TestTimer_Restart (0.05s)
	timer_test.go:20: 
			Error Trace:	timer_test.go:20
			Error:      	Not equal: 
			            	expected: 1
			            	actual  : 0
			Test:       	TestTimer_Restart
--- FAIL: TestTimer_Sleep (0.02s)
	timer_test.go:35: 
			Error Trace:	timer_test.go:35
			Error:      	Not equal: 
			            	expected: 1
			            	actual  : 0
			Test:       	TestTimer_Sleep

Reset Snapshot timer after re-announce

Currently if the host agent goes away and eventually comes back the Go sensor will properly re-announce when available but snapshot data is not resent on announce. Snapshot data will be sent on the next cycle (5 mins).

We need to reset the Snapshot timer in the case of a re-announce.

Current symptom is max 5 minutes without process Snapshot data.

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.