Skip to content

Commit

Permalink
Remove deprecated funcs from otlpgrpc (open-telemetry#5144)
Browse files Browse the repository at this point in the history
Because, most likely for the moment only otlp exporter/receiver is using this package, we can remove this after just one version, no third-party deps.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Apr 4, 2022
1 parent 02a7c92 commit 00fea83
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 144 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Remove deprecated structs/funcs from previous versions (#5131)
- Do not set TraceProvider to global otel (#5138)
- Remove deprecated funcs from otlpgrpc (#5144)

### 🚩 Deprecations 🚩

Expand Down
38 changes: 0 additions & 38 deletions model/otlpgrpc/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,6 @@ func NewLogsResponse() LogsResponse {
return LogsResponse{orig: &otlpcollectorlog.ExportLogsServiceResponse{}}
}

// Deprecated: [v0.48.0] use LogsResponse.UnmarshalProto.
func UnmarshalLogsResponse(data []byte) (LogsResponse, error) {
lr := NewLogsResponse()
err := lr.UnmarshalProto(data)
return lr, err
}

// Deprecated: [v0.48.0] use LogsResponse.UnmarshalJSON.
func UnmarshalJSONLogsResponse(data []byte) (LogsResponse, error) {
lr := NewLogsResponse()
err := lr.UnmarshalJSON(data)
return lr, err
}

// Deprecated: [v0.48.0] use MarshalProto.
func (lr LogsResponse) Marshal() ([]byte, error) {
return lr.MarshalProto()
}

// MarshalProto marshals LogsResponse into proto bytes.
func (lr LogsResponse) MarshalProto() ([]byte, error) {
return lr.orig.Marshal()
Expand Down Expand Up @@ -94,25 +75,6 @@ func NewLogsRequest() LogsRequest {
return LogsRequest{orig: &otlpcollectorlog.ExportLogsServiceRequest{}}
}

// Deprecated: [v0.48.0] use LogsRequest.UnmarshalProto.
func UnmarshalLogsRequest(data []byte) (LogsRequest, error) {
lr := NewLogsRequest()
err := lr.UnmarshalProto(data)
return lr, err
}

// Deprecated: [v0.48.0] use LogsRequest.UnmarshalJSON.
func UnmarshalJSONLogsRequest(data []byte) (LogsRequest, error) {
lr := NewLogsRequest()
err := lr.UnmarshalJSON(data)
return lr, err
}

// Deprecated: [v0.48.0] use MarshalProto.
func (lr LogsRequest) Marshal() ([]byte, error) {
return lr.MarshalProto()
}

// MarshalProto marshals LogsRequest into proto bytes.
func (lr LogsRequest) MarshalProto() ([]byte, error) {
return lr.orig.Marshal()
Expand Down
10 changes: 0 additions & 10 deletions model/otlpgrpc/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,6 @@ func TestLogsRequestJSONTransition(t *testing.T) {
}
}

func TestLogsRequestJSON_Deprecated(t *testing.T) {
lr, err := UnmarshalJSONLogsRequest(logsRequestJSON)
assert.NoError(t, err)
assert.Equal(t, "test_log_record", lr.Logs().ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Body().AsString())

got, err := lr.MarshalJSON()
assert.NoError(t, err)
assert.Equal(t, strings.Join(strings.Fields(string(logsRequestJSON)), ""), string(got))
}

func TestLogsGrpc(t *testing.T) {
lis := bufconn.Listen(1024 * 1024)
s := grpc.NewServer()
Expand Down
38 changes: 0 additions & 38 deletions model/otlpgrpc/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,6 @@ func NewMetricsResponse() MetricsResponse {
return MetricsResponse{orig: &otlpcollectormetrics.ExportMetricsServiceResponse{}}
}

// Deprecated: [v0.48.0] use MetricsResponse.UnmarshalProto.
func UnmarshalMetricsResponse(data []byte) (MetricsResponse, error) {
mr := NewMetricsResponse()
err := mr.UnmarshalProto(data)
return mr, err
}

// Deprecated: [v0.48.0] use MetricsResponse.UnmarshalJSON.
func UnmarshalJSONMetricsResponse(data []byte) (MetricsResponse, error) {
mr := NewMetricsResponse()
err := mr.UnmarshalJSON(data)
return mr, err
}

// Deprecated: [v0.48.0] use MarshalProto.
func (mr MetricsResponse) Marshal() ([]byte, error) {
return mr.MarshalProto()
}

// MarshalProto marshals MetricsResponse into proto bytes.
func (mr MetricsResponse) MarshalProto() ([]byte, error) {
return mr.orig.Marshal()
Expand Down Expand Up @@ -90,25 +71,6 @@ func NewMetricsRequest() MetricsRequest {
return MetricsRequest{orig: &otlpcollectormetrics.ExportMetricsServiceRequest{}}
}

// Deprecated: [v0.48.0] use MetricsRequest.UnmarshalProto.
func UnmarshalMetricsRequest(data []byte) (MetricsRequest, error) {
mr := NewMetricsRequest()
err := mr.UnmarshalProto(data)
return mr, err
}

// Deprecated: [v0.48.0] use MetricsRequest.UnmarshalJSON.
func UnmarshalJSONMetricsRequest(data []byte) (MetricsRequest, error) {
mr := NewMetricsRequest()
err := mr.UnmarshalJSON(data)
return mr, err
}

// Deprecated: [v0.48.0] use MarshalProto.
func (mr MetricsRequest) Marshal() ([]byte, error) {
return mr.MarshalProto()
}

// MarshalProto marshals MetricsRequest into proto bytes.
func (mr MetricsRequest) MarshalProto() ([]byte, error) {
return mr.orig.Marshal()
Expand Down
10 changes: 0 additions & 10 deletions model/otlpgrpc/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,6 @@ func TestMetricsRequestJSONTransition(t *testing.T) {
}
}

func TestMetricsRequestJSON_Deprecated(t *testing.T) {
mr, err := UnmarshalJSONMetricsRequest(metricsRequestJSON)
assert.NoError(t, err)
assert.Equal(t, "test_metric", mr.Metrics().ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0).Name())

got, err := mr.MarshalJSON()
assert.NoError(t, err)
assert.Equal(t, strings.Join(strings.Fields(string(metricsRequestJSON)), ""), string(got))
}

func TestMetricsGrpc(t *testing.T) {
lis := bufconn.Listen(1024 * 1024)
s := grpc.NewServer()
Expand Down
38 changes: 0 additions & 38 deletions model/otlpgrpc/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,6 @@ func NewTracesResponse() TracesResponse {
return TracesResponse{orig: &otlpcollectortrace.ExportTraceServiceResponse{}}
}

// Deprecated: [v0.48.0] use TracesResponse.UnmarshalProto.
func UnmarshalTracesResponse(data []byte) (TracesResponse, error) {
tr := NewTracesResponse()
err := tr.UnmarshalProto(data)
return tr, err
}

// Deprecated: [v0.48.0] use TracesResponse.UnmarshalJSON.
func UnmarshalJSONTracesResponse(data []byte) (TracesResponse, error) {
tr := NewTracesResponse()
err := tr.UnmarshalJSON(data)
return tr, err
}

// Deprecated: [v0.48.0] use MarshalProto.
func (tr TracesResponse) Marshal() ([]byte, error) {
return tr.MarshalProto()
}

// MarshalProto marshals TracesResponse into proto bytes.
func (tr TracesResponse) MarshalProto() ([]byte, error) {
return tr.orig.Marshal()
Expand Down Expand Up @@ -90,25 +71,6 @@ func NewTracesRequest() TracesRequest {
return TracesRequest{orig: &otlpcollectortrace.ExportTraceServiceRequest{}}
}

// Deprecated: [v0.48.0] use TracesRequest.UnmarshalProto.
func UnmarshalTracesRequest(data []byte) (TracesRequest, error) {
tr := NewTracesRequest()
err := tr.UnmarshalProto(data)
return tr, err
}

// Deprecated: [v0.48.0] use TracesRequest.UnmarshalJSON.
func UnmarshalJSONTracesRequest(data []byte) (TracesRequest, error) {
tr := NewTracesRequest()
err := tr.UnmarshalJSON(data)
return tr, err
}

// Deprecated: [v0.48.0] use MarshalProto.
func (tr TracesRequest) Marshal() ([]byte, error) {
return tr.MarshalProto()
}

// MarshalProto marshals TracesRequest into proto bytes.
func (tr TracesRequest) MarshalProto() ([]byte, error) {
return tr.orig.Marshal()
Expand Down
10 changes: 0 additions & 10 deletions model/otlpgrpc/traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,6 @@ func TestTracesRequestJSONTransition(t *testing.T) {
}
}

func TestTracesRequestJSON_Deprecated(t *testing.T) {
tr, err := UnmarshalJSONTracesRequest(tracesRequestJSON)
assert.NoError(t, err)
assert.Equal(t, "test_span", tr.Traces().ResourceSpans().At(0).ScopeSpans().At(0).Spans().At(0).Name())

got, err := tr.MarshalJSON()
assert.NoError(t, err)
assert.Equal(t, strings.Join(strings.Fields(string(tracesRequestJSON)), ""), string(got))
}

func TestTracesGrpc(t *testing.T) {
lis := bufconn.Listen(1024 * 1024)
s := grpc.NewServer()
Expand Down

0 comments on commit 00fea83

Please sign in to comment.