Skip to content

Commit 249aec1

Browse files
authored
[exporter/sentryexporter] unexport structs and methods which should be private (#40700)
resolves #40651
1 parent f798916 commit 249aec1

File tree

3 files changed

+44
-17
lines changed

3 files changed

+44
-17
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: sentryexporter
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: unexport structs and methods which should be private
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [40651]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [api]

exporter/sentryexporter/sentry_exporter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ var canonicalCodesGrpcMap = map[string]sentry.SpanStatus{
6868
"16": sentry.SpanStatusUnauthenticated,
6969
}
7070

71-
// SentryExporter defines the Sentry Exporter.
72-
type SentryExporter struct {
71+
// sentryExporter defines the Sentry Exporter.
72+
type sentryExporter struct {
7373
transport transport
7474
environment string
7575
}
7676

7777
// pushTraceData takes an incoming OpenTelemetry trace, converts them into Sentry spans and transactions
7878
// and sends them using Sentry's transport.
79-
func (s *SentryExporter) pushTraceData(_ context.Context, td ptrace.Traces) error {
79+
func (s *sentryExporter) pushTraceData(_ context.Context, td ptrace.Traces) error {
8080
var exceptionEvents []*sentry.Event
8181
resourceSpans := td.ResourceSpans()
8282
if resourceSpans.Len() == 0 {
@@ -492,7 +492,7 @@ func createSentryExporter(config *Config, set exporter.Settings) (exporter.Trace
492492

493493
transport.Configure(clientOptions)
494494

495-
s := &SentryExporter{
495+
s := &sentryExporter{
496496
transport: transport,
497497
environment: config.Environment,
498498
}

exporter/sentryexporter/sentry_exporter_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func generateOrphanSpansFromSpans(spans ...*sentry.Span) []*sentry.Span {
166166
return orphanSpans
167167
}
168168

169-
type SpanEventToSentryEventCases struct {
169+
type spanEventToSentryEventCases struct {
170170
testName string
171171
errorMessage string
172172
errorType string
@@ -221,7 +221,7 @@ func TestSpanEventToSentryEvent(t *testing.T) {
221221

222222
errorType := "mySampleType"
223223
errorMessage := "Kernel Panic"
224-
testCases := []SpanEventToSentryEventCases{
224+
testCases := []spanEventToSentryEventCases{
225225
{
226226
testName: "Exception Event with both exception type and message",
227227
errorMessage: errorMessage,
@@ -353,7 +353,7 @@ func TestSpanToSentrySpan(t *testing.T) {
353353
})
354354
}
355355

356-
type SpanDescriptorsCase struct {
356+
type spanDescriptorsCase struct {
357357
testName string
358358
// input
359359
name string
@@ -365,7 +365,7 @@ type SpanDescriptorsCase struct {
365365
}
366366

367367
func TestGenerateSpanDescriptors(t *testing.T) {
368-
testCases := []SpanDescriptorsCase{
368+
testCases := []spanDescriptorsCase{
369369
{
370370
testName: "http-client",
371371
name: "/api/users/{user_id}",
@@ -470,7 +470,7 @@ func TestGenerateTagsFromAttributes(t *testing.T) {
470470
assert.Equal(t, "321", intVal)
471471
}
472472

473-
type SpanStatusCase struct {
473+
type spanStatusCase struct {
474474
testName string
475475
// input
476476
spanStatus ptrace.Status
@@ -481,7 +481,7 @@ type SpanStatusCase struct {
481481
}
482482

483483
func TestStatusFromSpanStatus(t *testing.T) {
484-
testCases := []SpanStatusCase{
484+
testCases := []spanStatusCase{
485485
{
486486
testName: "with empty status",
487487
spanStatus: ptrace.NewStatus(),
@@ -569,7 +569,7 @@ func TestStatusFromSpanStatus(t *testing.T) {
569569
}
570570
}
571571

572-
type ClassifyOrphanSpanTestCase struct {
572+
type classifyOrphanSpanTestCase struct {
573573
testName string
574574
// input
575575
idMap map[sentry.SpanID]sentry.SpanID
@@ -580,7 +580,7 @@ type ClassifyOrphanSpanTestCase struct {
580580
}
581581

582582
func TestClassifyOrphanSpans(t *testing.T) {
583-
testCases := []ClassifyOrphanSpanTestCase{
583+
testCases := []classifyOrphanSpanTestCase{
584584
{
585585
testName: "with no root spans",
586586
idMap: make(map[sentry.SpanID]sentry.SpanID),
@@ -666,7 +666,7 @@ func (t *mockTransport) Flush(_ context.Context) bool {
666666
return true
667667
}
668668

669-
type PushTraceDataTestCase struct {
669+
type pushTraceDataTestCase struct {
670670
testName string
671671
// input
672672
td ptrace.Traces
@@ -675,7 +675,7 @@ type PushTraceDataTestCase struct {
675675
}
676676

677677
func TestPushTraceData(t *testing.T) {
678-
testCases := []PushTraceDataTestCase{
678+
testCases := []pushTraceDataTestCase{
679679
{
680680
testName: "with no resources",
681681
td: ptrace.NewTraces(),
@@ -719,7 +719,7 @@ func TestPushTraceData(t *testing.T) {
719719
transport := &mockTransport{
720720
called: false,
721721
}
722-
s := &SentryExporter{
722+
s := &sentryExporter{
723723
transport: transport,
724724
}
725725

@@ -730,7 +730,7 @@ func TestPushTraceData(t *testing.T) {
730730
}
731731
}
732732

733-
type TransactionFromSpanMarshalEventTestCase struct {
733+
type transactionFromSpanMarshalEventTestCase struct {
734734
testName string
735735
// input
736736
span *sentry.Span
@@ -741,7 +741,7 @@ type TransactionFromSpanMarshalEventTestCase struct {
741741
// This is a regression test for https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/13415
742742
// to make sure that `parent_span_id` is not included in the serialized context if it is not defined
743743
func TestTransactionContextFromSpanMarshalEvent(t *testing.T) {
744-
testCases := []TransactionFromSpanMarshalEventTestCase{
744+
testCases := []transactionFromSpanMarshalEventTestCase{
745745
{
746746
testName: "with parent span id",
747747
span: &sentry.Span{

0 commit comments

Comments
 (0)