Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/purview-dev/purview-telemetry-sourcegenerator
.NET Source Generator for interface-based telemetry building activities, activity events, logs and metrics.
https://github.com/purview-dev/purview-telemetry-sourcegenerator
activity distributed-tracing dotnet events logging metrics open-telemetry open-telemetry-csharp source-generator spans
Last synced: 14 days ago
JSON representation
.NET Source Generator for interface-based telemetry building activities, activity events, logs and metrics.
- Host: GitHub
- URL: https://github.com/purview-dev/purview-telemetry-sourcegenerator
- Owner: purview-dev
- License: mit
- Created: 2024-03-04T18:31:56.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-13T20:44:14.000Z (7 months ago)
- Last Synced: 2024-04-14T10:58:28.807Z (7 months ago)
- Topics: activity, distributed-tracing, dotnet, events, logging, metrics, open-telemetry, open-telemetry-csharp, source-generator, spans
- Language: C#
- Homepage:
- Size: 1.66 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Purview Telemetry Source Generator
Generates [ActivitySource](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.activitysource), [High-performance logging](https://learn.microsoft.com/en-us/dotnet/core/extensions/high-performance-logging) and [Metrics](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.metrics) based on methods on an interface, enabling fast iteration cycles, dependency injection and substitutes for testing.
The latest version is available on [NuGet](https://www.nuget.org/packages/Purview.Telemetry.SourceGenerator/), and supports generating for the following frameworks:
* .NET Framework 4.7.2
* .NET Framework 4.8
* .NET 7
* .NET 8
* .NET 9```csharp
[ActivitySource]
[Logger]
[Meter]
interface IEntityStoreTelemetry
{
///
/// Creates and starts an Activity and adds the parameters as Tags and Baggage.
///
[Activity]
Activity? GettingEntityFromStore(int entityId, [Baggage]string serviceUrl);///
/// Adds an ActivityEvent to the Activity with the parameters as Tags.
///
[Event]
void GetDuration(Activity? activity, int durationInMS);///
/// Adds the parameters as Baggage to the Activity.
///
[Context]
void RetrievedEntity(Activity? activity, float totalValue, int lastUpdatedByUserId);///
/// Generates a structured log message using an ILogger.
///
[Log]
void ProcessingEntity(int entityId, string updateState);///
/// Adds 1 to a Counter with the entityId as a Tag.
///
[AutoCounter]
void RetrievingEntity(int entityId);
}
```For more information see the [wiki](https://github.com/purview-dev/purview-telemetry-sourcegenerator/wiki).