Skip to content

Commit

Permalink
[exporter/sentryexporter] Upgrade github.com/getsentry/sentry-go from…
Browse files Browse the repository at this point in the history
… 0.13.0 to 0.14.0 (open-telemetry#14928)
  • Loading branch information
AbhiPrasad authored and shalper2 committed Dec 6, 2022
1 parent f212235 commit 634ee28
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 39 deletions.
6 changes: 3 additions & 3 deletions cmd/configschema/go.mod
Expand Up @@ -163,7 +163,7 @@ require (
github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.0 // indirect
github.com/getsentry/sentry-go v0.13.0 // indirect
github.com/getsentry/sentry-go v0.14.0 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
github.com/go-kit/kit v0.12.0 // indirect
Expand Down Expand Up @@ -529,7 +529,7 @@ require (
github.com/signalfx/sapm-proto v0.12.0 // indirect
github.com/signalfx/signalfx-agent/pkg/apm v0.0.0-20220920175102-539ae8d8ba8e // indirect
github.com/sijms/go-ora/v2 v2.5.3 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/snowflakedb/gosnowflake v1.6.13 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
Expand Down Expand Up @@ -599,7 +599,7 @@ require (
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 // indirect
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
gonum.org/v1/gonum v0.12.0 // indirect
Expand Down
14 changes: 8 additions & 6 deletions cmd/configschema/go.sum

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

6 changes: 3 additions & 3 deletions exporter/sentryexporter/go.mod
Expand Up @@ -3,7 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sentry
go 1.18

require (
github.com/getsentry/sentry-go v0.13.0
github.com/getsentry/sentry-go v0.14.0
github.com/google/go-cmp v0.5.9
github.com/stretchr/testify v1.8.0
go.opentelemetry.io/collector v0.62.0
Expand Down Expand Up @@ -34,8 +34,8 @@ require (
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 // indirect
golang.org/x/net v0.0.0-20221002022538-bcab6841153b // indirect
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.50.0 // indirect
Expand Down
14 changes: 7 additions & 7 deletions exporter/sentryexporter/go.sum

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

6 changes: 3 additions & 3 deletions exporter/sentryexporter/sentry_exporter.go
Expand Up @@ -211,7 +211,7 @@ func sentryEventFromError(errorMessage, errorType string, span *sentry.Span) (*s
Op: span.Op,
Description: span.Description,
Status: span.Status,
}
}.Map()

event.Type = errorType
event.Message = errorMessage
Expand Down Expand Up @@ -436,14 +436,14 @@ func transactionFromSpan(span *sentry.Span) *sentry.Event {
transaction := sentry.NewEvent()
transaction.EventID = generateEventID()

transaction.Contexts["trace"] = &sentry.TraceContext{
transaction.Contexts["trace"] = sentry.TraceContext{
TraceID: span.TraceID,
SpanID: span.SpanID,
ParentSpanID: span.ParentSpanID,
Op: span.Op,
Description: span.Description,
Status: span.Status,
}
}.Map()

transaction.Type = "transaction"

Expand Down
15 changes: 9 additions & 6 deletions exporter/sentryexporter/sentry_exporter_test.go
Expand Up @@ -212,7 +212,7 @@ func TestSpanEventToSentryEvent(t *testing.T) {
Tags: sampleSentrySpanForEvent.Tags,
Timestamp: sampleSentrySpanForEvent.EndTime,
Transaction: sampleSentrySpanForEvent.Description,
Contexts: map[string]interface{}{},
Contexts: map[string]sentry.Context{},
Extra: map[string]interface{}{},
Modules: map[string]string{},
StartTime: unixNanoToTime(123),
Expand All @@ -224,7 +224,8 @@ func TestSpanEventToSentryEvent(t *testing.T) {
Op: sampleSentrySpanForEvent.Op,
Description: sampleSentrySpanForEvent.Description,
Status: sampleSentrySpanForEvent.Status,
}
}.Map()

errorType := "mySampleType"
errorMessage := "Kernel Panic"
testCases := []SpanEventToSentryEventCases{
Expand Down Expand Up @@ -744,7 +745,9 @@ type TransactionFromSpanMarshalEventTestCase struct {
wantContains string
}

func TestTransactionFromSpanMarshalEvent(t *testing.T) {
// This is a regression test for https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/13415
// to make sure that `parent_span_id` is not included in the serialized context if it is not defined
func TestTransactionContextFromSpanMarshalEvent(t *testing.T) {
testCases := []TransactionFromSpanMarshalEventTestCase{
{
testName: "with parent span id",
Expand All @@ -753,15 +756,15 @@ func TestTransactionFromSpanMarshalEvent(t *testing.T) {
SpanID: SpanIDFromHex("ea4864700408805c"),
ParentSpanID: SpanIDFromHex("4c577fe4aec9523b"),
},
wantContains: `"contexts":{"trace":{"trace_id":"1915f8aa35ff8fbebbfeedb9d7e07216","span_id":"ea4864700408805c","parent_span_id":"4c577fe4aec9523b"}}`,
wantContains: `{"trace":{"parent_span_id":"4c577fe4aec9523b","span_id":"ea4864700408805c","trace_id":"1915f8aa35ff8fbebbfeedb9d7e07216"}}`,
},
{
testName: "without parent span id",
span: &sentry.Span{
TraceID: TraceIDFromHex("11ab4adc8ac6ed96f245cd96b5b6d141"),
SpanID: SpanIDFromHex("cc55ac735f0170ac"),
},
wantContains: `"contexts":{"trace":{"trace_id":"11ab4adc8ac6ed96f245cd96b5b6d141","span_id":"cc55ac735f0170ac"}}`,
wantContains: `{"trace":{"span_id":"cc55ac735f0170ac","trace_id":"11ab4adc8ac6ed96f245cd96b5b6d141"}}`,
},
}

Expand All @@ -770,7 +773,7 @@ func TestTransactionFromSpanMarshalEvent(t *testing.T) {
event := transactionFromSpan(test.span)
// mimic what sentry is doing internally
// see: https://github.com/getsentry/sentry-go/blob/v0.13.0/transport.go#L66-L70
d, err := json.Marshal(event)
d, err := json.Marshal(event.Contexts)
assert.NoError(t, err)
assert.Contains(t, string(d), test.wantContains)
})
Expand Down
7 changes: 3 additions & 4 deletions go.mod
Expand Up @@ -312,8 +312,7 @@ require (
github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.0 // indirect
github.com/getsentry/sentry-go v0.13.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/getsentry/sentry-go v0.14.0 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
github.com/go-kit/kit v0.12.0 // indirect
Expand Down Expand Up @@ -530,7 +529,7 @@ require (
github.com/signalfx/sapm-proto v0.12.0 // indirect
github.com/signalfx/signalfx-agent/pkg/apm v0.0.0-20220920175102-539ae8d8ba8e // indirect
github.com/sijms/go-ora/v2 v2.5.3 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/snowflakedb/gosnowflake v1.6.13 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
Expand Down Expand Up @@ -603,7 +602,7 @@ require (
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 // indirect
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
golang.org/x/text v0.3.8 // indirect
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
gonum.org/v1/gonum v0.12.0 // indirect
Expand Down

0 comments on commit 634ee28

Please sign in to comment.