Skip to content

Commit

Permalink
Address comments and add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ManiaKazemzadeh committed Jan 10, 2025
1 parent ea1fbbb commit bc10fad
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 15 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http
## [Unreleased]

### Added

- Update `httpPlusdb` demo with adding `OTEL_GO_AUTO_PARSE_DB_STATEMENT` env variable ([#1523](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1523))
- Support `SELECT`, `INSERT`, `UPDATE`, and `DELETE` for database span names and `db.operation.name` attribute. ([#1253](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1253))
- Support the full tracing API with the `otelglobal` probe. ([#1405](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1405))
Expand All @@ -23,6 +24,10 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http
- Support `golang.org/x/net` `0.34.0`. ([#1552](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1552))
- Support `google.golang.org/grpc` `1.71.0-dev`. ([#1467](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1467))

### Fixed

- Respect `OTEL_EXPORTER_OTLP_PROTOCOL` when `OTEL_TRACES_EXPORTER` is not set. ([#1572](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1572))

## [v0.19.0-alpha] - 2024-12-05

### Added
Expand Down Expand Up @@ -66,7 +71,7 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http

- The deprecated `go.opentelemetry.io/auto/sdk/telemetry` package is removed. ([#1252](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1252))
- The deprecated `go.opentelemetry.io/auto/sdk/telemetry/test` module is removed. ([#1252](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1252))
- Remove the `WithLoadedIndicator` `InstrumentationOption` since the `Instrumentation.Load` will indicate whether the probes are loaded in a synchronous way. ([#1245](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1245))
- Remove the `WithLoadedIndicator` `InstrumentationOption` since the `Instrumentation.Load` will indicate whether the probes are loaded in a synchronous way. ([#1245](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1245))

## [v0.17.0-alpha] - 2024-11-05

Expand Down Expand Up @@ -114,7 +119,7 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http
- Support Go `v1.22.6`. ([#988](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/988))
- Support `golang.org/x/net` `v0.28.0`. ([#988](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/988))
- Support `google.golang.org/grpc` `1.67.0-dev`. ([#1007](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1007))
- Support Go `1.23.0`. ([#1007](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1007))
- Support Go `1.23.0`. ([#1007](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1007))
- Introduce `config.Provider` as an option to set the initial configuration and update it in runtime. ([#1010](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1010))
- Support `go.opentelemetry.io/otel@v1.29.0`. ([#1032](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1032))
- Support `google.golang.org/grpc` `1.66.0`. ([#1046](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1046))
Expand Down Expand Up @@ -552,5 +557,4 @@ This is the first release of OpenTelemetry Go Automatic Instrumentation.
[v0.2.1-alpha]: https://github.com/open-telemetry/opentelemetry-go-instrumentation/releases/tag/v0.2.1-alpha
[v0.2.0-alpha]: https://github.com/open-telemetry/opentelemetry-go-instrumentation/releases/tag/v0.2.0-alpha
[v0.1.0-alpha]: https://github.com/open-telemetry/opentelemetry-go-instrumentation/releases/tag/v0.1.0-alpha

[Go 1.22]: https://go.dev/doc/go1.22
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ retract (

require (
github.com/cilium/ebpf v0.17.1
github.com/go-logr/stdr v1.2.2
github.com/hashicorp/go-version v1.7.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.10.0
github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2
go.opentelemetry.io/collector/pdata v1.23.0
go.opentelemetry.io/contrib/exporters/autoexport v0.58.0
go.opentelemetry.io/otel v1.33.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0
go.opentelemetry.io/otel/sdk v1.33.0
go.opentelemetry.io/otel/trace v1.33.0
Expand All @@ -41,7 +43,6 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect
Expand All @@ -61,7 +62,6 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.9.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.33.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.33.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.55.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.9.0 // indirect
Expand Down
16 changes: 8 additions & 8 deletions instrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,14 @@ func WithEnv() InstrumentationOption {
if v, ok := lookupEnv(envTargetExeKey); ok {
c.target = process.TargetArgs{ExePath: v}
}
{
var e error
// NewSpanExporter will use an OTLP (HTTP/protobuf) exporter as the
// default, unless OTLP_TRACES_EXPORTER is set. This is the OTel
// recommended default.
c.traceExp, e = autoexport.NewSpanExporter(ctx)
err = errors.Join(err, e)
}

var e error
// NewSpanExporter will use an OTLP (HTTP/protobuf) exporter as the
// default, unless OTLP_TRACES_EXPORTER is set. This is the OTel
// recommended default.
c.traceExp, e = autoexport.NewSpanExporter(ctx)
err = errors.Join(err, e)

if name, attrs, ok := lookupResourceData(); ok {
c.serviceName = name
c.additionalResAttrs = append(c.additionalResAttrs, attrs...)
Expand Down
19 changes: 17 additions & 2 deletions instrumentation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
package auto

import (
"bytes"
"context"
"fmt"
"io"
"log"
"log/slog"
"os"
"testing"

"github.com/go-logr/stdr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"

"go.opentelemetry.io/auto/internal/pkg/instrumentation/probe/sampling"
Expand Down Expand Up @@ -98,13 +103,23 @@ func TestWithEnv(t *testing.T) {
})

// Test that autoexport.NewSpanExporter works when OTEL_TRACES_EXPORTER is
// not set
// not set and OTEL_EXPORTER_OTLP_PROTOCOL is set to 'grpc'
t.Run("With OTEL_TRACES_EXPORTER not set", func(t *testing.T) {
os.Unsetenv("OTEL_TRACES_EXPORTER")
t.Setenv("OTEL_EXPORTER_OTLP_PROTOCOL", "grpc")
c, err := newInstConfig(context.Background(), []InstrumentationOption{WithEnv()})

require.NoError(t, err)
assert.NotNil(t, c.traceExp)
require.NotNil(t, c.traceExp)
require.IsType(t, &otlptrace.Exporter{}, c.traceExp)
exp := c.traceExp.(*otlptrace.Exporter)
var buf bytes.Buffer
logger := stdr.New(log.New(&buf, "", log.LstdFlags))
logger.Info("", "exporter", exp)
got, err := io.ReadAll(&buf)
require.NoError(t, err)
// "otlphttphttp" should be "otlptracegrpc". This is a bug upstream.
assert.Contains(t, string(got), "otlphttpgrpc")
})
}

Expand Down

0 comments on commit bc10fad

Please sign in to comment.