Skip to content

Commit

Permalink
Fixed README.md formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sablancoleis committed Nov 3, 2024
1 parent 0625186 commit a27127b
Showing 1 changed file with 44 additions and 19 deletions.
63 changes: 44 additions & 19 deletions src/OpenTelemetry.Instrumentation.ServiceFabricRemoting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
[![codecov.io](https://codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib/branch/main/graphs/badge.svg?flag=unittests-Instrumentation.ServiceFabricRemoting)](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet-contrib?flags[0]=unittests-Instrumentation.ServiceFabricRemoting)

This is an [Instrumentation Library](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/glossary.md#instrumentation-library),
which instruments [Service Fabric Remoting](https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting) and collects telemetry about incoming requests.
which instruments [Service Fabric Remoting](https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting)
and collects telemetry about incoming requests.

## Steps to enable OpenTelemetry.Instrumentation.ServiceFabricRemoting

Expand All @@ -29,9 +30,12 @@ dotnet add package OpenTelemetry.Instrumentation.ServiceFabricRemoting

### Step 2: Configure SF Remoting with Distributed Tracing instrumentation

These instructions are a moified vertion of the steps mentioned here: [`Use an assembly attribute to use the V2 stack`](https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting#use-an-assembly-attribute-to-use-the-v2-stack)
These instructions are a moified vertion of the steps mentioned here:
[`Use an assembly attribute to use the V2 stack`](https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting#use-an-assembly-attribute-to-use-the-v2-stack)

a) Change the endpoint resource from "ServiceEndpoint" to "ServiceEndpointV2"
in the service manifest.

1. Change the endpoint resource from "ServiceEndpoint" to "ServiceEndpointV2" in the service manifest.
```xml
<Resources>
<Endpoints>
Expand All @@ -40,16 +44,23 @@ These instructions are a moified vertion of the steps mentioned here: [`Use an a
</Resources>
```

2. Use the Microsoft.ServiceFabric.Services.Remoting.Runtime.CreateServiceRemotingInstanceListeners extension method to create remoting listeners .
b) Use the Microsoft.ServiceFabric.Services.Remoting.Runtime
.CreateServiceRemotingInstanceListeners
extension method to create remoting listeners.

```csharp
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return this.CreateServiceRemotingInstanceListeners();
}
```

3. Mark the assembly that contains the remoting interfaces with a **TraceContextEnrichedActorRemotingProvider** and/or a **TraceContextEnrichedServiceRemotingProvider** attribute.
*Note that these attributes are not part of the Service Fabric SDK and are provided by the OpenTelemetry.Instrumentation.ServiceFabricRemoting package.**
c) Mark the assembly that contains the remoting interfaces with a
**TraceContextEnrichedActorRemotingProvider** and/or a
**TraceContextEnrichedServiceRemotingProvider** attribute.
*Note that these attributes are not part of the Service Fabric SDK
and are provided by the OpenTelemetry.Instrumentation.ServiceFabricRemoting package.**

```csharp
[assembly: TraceContextEnrichedActorRemotingProvider()]
[assembly: TraceContextEnrichedServiceRemotingProvider()]
Expand All @@ -59,7 +70,8 @@ These instructions are a moified vertion of the steps mentioned here: [`Use an a

#### Configure OpenTelemetry TracerProvider in Program.cs

Call the `AddServiceFabricRemotingInstrumentation` extension method on the `TracerProviderBuilder` to register the OpenTelemetry instrumentation.
Call the `AddServiceFabricRemotingInstrumentation` extension method on the
`TracerProviderBuilder` to register the OpenTelemetry instrumentation.

```csharp

Expand All @@ -71,15 +83,24 @@ Call the `AddServiceFabricRemotingInstrumentation` extension method on the `Trac
.Build();
```

This will register the `ServiceFabric.Remoting` ActivitySource and create spans for incoming and outgoing remoting calls.
This will register the `ServiceFabric.Remoting` ActivitySource and create
spans for incoming and outgoing remoting calls.

It will also automatically inject the trace context and Baggage into the remoting headers, and extract them on the receiving side.
It will also automatically inject the trace context and Baggage into the
remoting headers, and extract them on the receiving side.

#### Configuration options

The `AddServiceFabricRemotingInstrumentation` extension method takes an optional `ServiceFabricRemotingInstrumentationOptions` parameter that offers the following configurable settings:
The `AddServiceFabricRemotingInstrumentation` extension method takes an optional
`ServiceFabricRemotingInstrumentationOptions` parameter that offers the following
configurable settings:

- **Filter** - A filter function that can be used to exclude certain remoting calls from being instrumented. The function takes a `ServiceRemotingRequest` and returns a boolean value. If the function returns `true`, the remoting call will be instrumented. If the function returns `false`, the remoting call will not be instrumented. By default, all remoting calls are instrumented.
- **Filter** - A filter function that can be used to exclude certain remoting
calls from being instrumented.
The function takes a `ServiceRemotingRequest` and returns a boolean value.
If the function returns `true`, the remoting call will be instrumented.
If the function returns `false`, the remoting call will not be instrumented.
By default, all remoting calls are instrumented.

```csharp
TracerProvider tracerProvider = Sdk.CreateTracerProviderBuilder()
Expand All @@ -101,8 +122,11 @@ The `AddServiceFabricRemotingInstrumentation` extension method takes an optional
.Build();
```

- **EnrichAtClientFromRequest** - A function that can be used to enrich the span created for the client side of the remoting call. The function takes a `Activity` and a `ServiceRemotingRequest` and returns the `Activity`.
By default, the client span is enriched with the service interface name and method name.
- **EnrichAtClientFromRequest** - A function that can be used to enrich the span
created for the client side of the remoting call.
The function takes a `Activity` and a `ServiceRemotingRequest` and returns the `Activity`.
By default, the client span is enriched with the service interface name
and method name.

```csharp
TracerProvider tracerProvider = Sdk.CreateTracerProviderBuilder()
Expand All @@ -118,11 +142,13 @@ The `AddServiceFabricRemotingInstrumentation` extension method takes an optional
})
.AddConsoleExporter()
.Build();

```

- **EnrichAtServerFromRequest** - A function that can be used to enrich the span created for the server side of the remoting call. The function takes a `Activity` and a `ServiceRemotingRequest` and returns the `Activity`.
By default, the server span is enriched with the service interface name and method name.
- **EnrichAtServerFromRequest** - A function that can be used to enrich the span
created for the server side of the remoting call.
The function takes a `Activity` and a `ServiceRemotingRequest` and returns the `Activity`.
By default, the server span is enriched with the service interface
name and method name.

```csharp
TracerProvider tracerProvider = Sdk.CreateTracerProviderBuilder()
Expand All @@ -138,10 +164,9 @@ The `AddServiceFabricRemotingInstrumentation` extension method takes an optional
})
.AddConsoleExporter()
.Build();

```

## References

* [Azure Service Fabric documentation](https://learn.microsoft.com/en-us/azure/service-fabric/)
* [OpenTelemetry Project](https://opentelemetry.io/)
- [Azure Service Fabric documentation](https://learn.microsoft.com/en-us/azure/service-fabric/)
- [OpenTelemetry Project](https://opentelemetry.io/)

0 comments on commit a27127b

Please sign in to comment.