Skip to content

Commit

Permalink
Updated README.md and renamed RecordException* to AddException* in op…
Browse files Browse the repository at this point in the history
…tions.
  • Loading branch information
sablancoleis committed Nov 23, 2024
1 parent c478a74 commit 2f26254
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.AddExceptionAtClient.get -> bool
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.AddExceptionAtClient.set -> void
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.AddExceptionAtServer.get -> bool
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.AddExceptionAtServer.set -> void
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.EnrichAtClientFromRequest.get -> System.Action<System.Diagnostics.Activity!, Microsoft.ServiceFabric.Services.Remoting.V2.IServiceRemotingRequestMessage!>?
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.EnrichAtClientFromRequest.set -> void
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.EnrichAtClientFromResponse.get -> System.Action<System.Diagnostics.Activity!, Microsoft.ServiceFabric.Services.Remoting.V2.IServiceRemotingResponseMessage?, System.Exception?>?
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.EnrichAtClientFromResponse.set -> void
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.Filter.get -> System.Func<Microsoft.ServiceFabric.Services.Remoting.V2.IServiceRemotingRequestMessage!, bool>?
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.Filter.set -> void
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.RecordExceptionAtClient.get -> bool
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.RecordExceptionAtClient.set -> void
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.RecordExceptionAtServer.get -> bool
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.RecordExceptionAtServer.set -> void
OpenTelemetry.Instrumentation.ServiceFabricRemoting.ServiceFabricRemotingInstrumentationOptions.ServiceFabricRemotingInstrumentationOptions() -> void
OpenTelemetry.Instrumentation.ServiceFabricRemoting.TraceContextEnrichedActorRemotingProviderAttribute
OpenTelemetry.Instrumentation.ServiceFabricRemoting.TraceContextEnrichedActorRemotingProviderAttribute.TraceContextEnrichedActorRemotingProviderAttribute() -> void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public override async Task<IServiceRemotingResponseMessage> HandleRequestRespons
{
activity.SetStatus(ActivityStatusCode.Error);

if (ServiceFabricRemotingActivitySource.Options?.RecordExceptionAtServer == true)
if (ServiceFabricRemotingActivitySource.Options?.AddExceptionAtServer == true)
{
activity.AddException(ex);
}
Expand Down
43 changes: 32 additions & 11 deletions src/OpenTelemetry.Instrumentation.ServiceFabricRemoting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

| Status | |
| ------------- |-----------|
| Stability | |
| Code Owners | |
| Stability | [Beta](../../README.md#beta)|
| Code Owners | [@sablancoleis](https://github.com/sablancoleis)

[![NuGet version badge](https://img.shields.io/nuget/v/OpenTelemetry.Instrumentation.ServiceFabricRemoting)](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.ServiceFabricRemoting)
[![NuGet download count badge](https://img.shields.io/nuget/dt/OpenTelemetry.Instrumentation.ServiceFabricRemoting)](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.ServiceFabricRemoting)
Expand All @@ -15,8 +15,6 @@ and collects telemetry about incoming requests.

## Steps to enable OpenTelemetry.Instrumentation.ServiceFabricRemoting

An example project is available in the
[examples//serviceFabricRemoting](../../examples/serviceFabricRemoting/) folder.

### Step 1: Install Package

Expand Down Expand Up @@ -74,12 +72,10 @@ Call the `AddServiceFabricRemotingInstrumentation` extension method on the
`TracerProviderBuilder` to register the OpenTelemetry instrumentation.

```csharp


TracerProvider tracerProvider = Sdk.CreateTracerProviderBuilder()
using TracerProvider tracerProvider = Sdk.CreateTracerProviderBuilder()
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("ServiceFabricRemoting-Example"))
.AddServiceFabricRemotingInstrumentation()
.AddConsoleExporter()
.AddOtlpExporter()
.Build();
```

Expand Down Expand Up @@ -118,7 +114,7 @@ By default, all remoting calls are instrumented.
return true;
};
})
.AddConsoleExporter()
.AddOtlpExporter()
.Build();
```

Expand All @@ -140,7 +136,7 @@ and method name.
return activity;
};
})
.AddConsoleExporter()
.AddOtlpExporter()
.Build();
```

Expand All @@ -162,10 +158,35 @@ name and method name.
return activity;
};
})
.AddConsoleExporter()
.AddOtlpExporter()
.Build();
```

- **AddExceptionAtClient** - Gets or sets a value indicating whether the exception will be recorded at the client as an `ActivityEvent` or not.
```csharp
TracerProvider tracerProvider = Sdk.CreateTracerProviderBuilder()
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("ServiceFabricRemoting-Example"))
.AddServiceFabricRemotingInstrumentation(options =>
{
options.AddExceptionAtClient = true;
})
.AddOtlpExporter()
.Build();
```

- **AddExceptionAtServer** - Gets or sets a value indicating whether the exception will be recorded at the server as an `ActivityEvent` or not
```csharp
TracerProvider tracerProvider = Sdk.CreateTracerProviderBuilder()
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("ServiceFabricRemoting-Example"))
.AddServiceFabricRemotingInstrumentation(options =>
{
options.AddExceptionAtServer = true;
})
.AddOtlpExporter()
.Build();
```


## References

- [Azure Service Fabric documentation](https://learn.microsoft.com/en-us/azure/service-fabric/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public ServiceFabricRemotingInstrumentationOptions()
/// Gets or sets a value indicating whether the exception will be recorded at the client as <see cref="ActivityEvent"/> or not.
/// </summary>
/// <remarks>
/// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/exceptions.md.
/// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/exceptions.md.
/// </remarks>
public bool RecordExceptionAtClient { get; set; }
public bool AddExceptionAtClient { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the exception will be recorded at the server as <see cref="ActivityEvent"/> or not.
/// </summary>
/// <remarks>
/// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/exceptions.md.
/// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/exceptions.md.
/// </remarks>
public bool RecordExceptionAtServer { get; set; }
public bool AddExceptionAtServer { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public override async Task<IServiceRemotingResponseMessage> HandleRequestRespons
{
activity.SetStatus(ActivityStatusCode.Error);

if (ServiceFabricRemotingActivitySource.Options?.RecordExceptionAtServer == true)
if (ServiceFabricRemotingActivitySource.Options?.AddExceptionAtServer == true)
{
activity.AddException(ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public async Task<IServiceRemotingResponseMessage> RequestResponseAsync(IService
{
activity.SetStatus(ActivityStatusCode.Error);

if (ServiceFabricRemotingActivitySource.Options?.RecordExceptionAtClient == true)
if (ServiceFabricRemotingActivitySource.Options?.AddExceptionAtClient == true)
{
activity.AddException(ex);
}
Expand Down

0 comments on commit 2f26254

Please sign in to comment.