Skip to content

Commit

Permalink
[chore] Replace usage of opencensus trace with otel trace in signalfx…
Browse files Browse the repository at this point in the history
…receiver

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu committed Dec 15, 2023
1 parent 3a24d2e commit 6f72316
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
5 changes: 2 additions & 3 deletions receiver/signalfxreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.91.0
github.com/signalfx/com_signalfx_metrics_protobuf v0.0.3
github.com/stretchr/testify v1.8.4
go.opencensus.io v0.24.0
go.opentelemetry.io/collector/component v0.91.0
go.opentelemetry.io/collector/config/confighttp v0.91.0
go.opentelemetry.io/collector/config/configtls v0.91.0
Expand All @@ -20,7 +19,6 @@ require (
go.opentelemetry.io/collector/exporter v0.91.0
go.opentelemetry.io/collector/pdata v1.0.0
go.opentelemetry.io/collector/receiver v0.91.0
go.opentelemetry.io/collector/semconv v0.91.0
go.uber.org/zap v1.26.0
)

Expand All @@ -35,7 +33,6 @@ require (
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
Expand All @@ -62,6 +59,7 @@ require (
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/collector v0.91.0 // indirect
go.opentelemetry.io/collector/config/configauth v0.91.0 // indirect
go.opentelemetry.io/collector/config/configcompression v0.91.0 // indirect
Expand All @@ -71,6 +69,7 @@ require (
go.opentelemetry.io/collector/extension v0.91.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.91.0 // indirect
go.opentelemetry.io/collector/featuregate v1.0.0 // indirect
go.opentelemetry.io/collector/semconv v0.91.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
Expand Down
1 change: 0 additions & 1 deletion receiver/signalfxreceiver/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 1 addition & 18 deletions receiver/signalfxreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ import (

"github.com/gorilla/mux"
sfxpb "github.com/signalfx/com_signalfx_metrics_protobuf/model"
"go.opencensus.io/trace"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/pdata/plog"
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver/receiverhelper"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk"
Expand Down Expand Up @@ -329,22 +327,7 @@ func (r *sfxReceiver) failRequest(
// Use the same pattern as strings.Builder String().
msg := *(*string)(unsafe.Pointer(&jsonResponse))

reqSpan := trace.FromContext(ctx)
reqSpan.AddAttributes(
trace.Int64Attribute(conventions.AttributeHTTPStatusCode, int64(httpStatusCode)),
trace.StringAttribute("http.status_text", msg))
traceStatus := trace.Status{
Code: trace.StatusCodeInvalidArgument,
}
if httpStatusCode == http.StatusInternalServerError {
traceStatus.Code = trace.StatusCodeInternal
}
if err != nil {
traceStatus.Message = err.Error()
}
reqSpan.SetStatus(traceStatus)
reqSpan.End()

r.obsrecv.EndMetricsOp(ctx, metadata.Type, 0, err)
r.settings.Logger.Debug(
"SignalFx receiver request failed",
zap.Int("http_status_code", httpStatusCode),
Expand Down

0 comments on commit 6f72316

Please sign in to comment.