Skip to content

Commit

Permalink
Otlp include batch transformation into try/catch scope (#2915)
Browse files Browse the repository at this point in the history
Co-authored-by: Cijo Thomas <[email protected]>
  • Loading branch information
glucaci and cijothomas authored Feb 22, 2022
1 parent 4b3ee96 commit 71c22ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ public override ExportResult Export(in Batch<LogRecord> logRecordBatch)

var request = new OtlpCollector.ExportLogsServiceRequest();

request.AddBatch(this.ProcessResource, logRecordBatch);

try
{
request.AddBatch(this.ProcessResource, logRecordBatch);

if (!this.exportClient.SendExportRequest(request))
{
return ExportResult.Failure;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public override ExportResult Export(in Batch<Metric> metrics)

var request = new OtlpCollector.ExportMetricsServiceRequest();

request.AddMetrics(this.ProcessResource, metrics);

try
{
request.AddMetrics(this.ProcessResource, metrics);

if (!this.exportClient.SendExportRequest(request))
{
return ExportResult.Failure;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public override ExportResult Export(in Batch<Activity> activityBatch)

var request = new OtlpCollector.ExportTraceServiceRequest();

request.AddBatch(this.ProcessResource, activityBatch);

try
{
request.AddBatch(this.ProcessResource, activityBatch);

if (!this.exportClient.SendExportRequest(request))
{
return ExportResult.Failure;
Expand All @@ -81,7 +81,6 @@ public override ExportResult Export(in Batch<Activity> activityBatch)
catch (Exception ex)
{
OpenTelemetryProtocolExporterEventSource.Log.ExportMethodException(ex);

return ExportResult.Failure;
}
finally
Expand Down

0 comments on commit 71c22ac

Please sign in to comment.