Motadata.CustomInstrumentationTest
1.0.0
dotnet add package Motadata.CustomInstrumentationTest --version 1.0.0
NuGet\Install-Package Motadata.CustomInstrumentationTest -Version 1.0.0
<PackageReference Include="Motadata.CustomInstrumentationTest" Version="1.0.0" />
<PackageVersion Include="Motadata.CustomInstrumentationTest" Version="1.0.0" />
<PackageReference Include="Motadata.CustomInstrumentationTest" />
paket add Motadata.CustomInstrumentationTest --version 1.0.0
#r "nuget: Motadata.CustomInstrumentationTest, 1.0.0"
#:package Motadata.CustomInstrumentationTest@1.0.0
#addin nuget:?package=Motadata.CustomInstrumentationTest&version=1.0.0
#tool nuget:?package=Motadata.CustomInstrumentationTest&version=1.0.0
Motadata Custom Instrumentation
Custom instrumentation utility for OpenTelemetry spans in .NET applications. Provides easy-to-use APIs for setting custom attributes on spans with automatic validation and type conversion.
🚀 Features
- ✅ Easy-to-use API - Simple static methods for setting span attributes
- ✅ Automatic key prefixing - All keys automatically prefixed with
apm. - ✅ Type safety - Support for bool, int, long, float, double, string, and arrays
- ✅ Validation - Built-in validation for keys and values with descriptive error messages
- ✅ Cross-platform - Works on Windows, Linux, and macOS
- ✅ Multi-framework support - .NET Framework 4.6.2+, .NET Standard 2.0, .NET 8, .NET 9
📦 Installation
NuGet Package Manager
dotnet add package Motadata.CustomInstrumentationTest
Package Manager Console
Install-Package Motadata.CustomInstrumentationTest
🔧 Usage
Basic Examples
using Motadata.Apm;
// Set scalar attributes
CustomInstrumentation.Set("user.id", 12345);
CustomInstrumentation.Set("user.name", "John Doe");
CustomInstrumentation.Set("is.premium", true);
CustomInstrumentation.Set("response.time", 123.45);
CustomInstrumentation.Set("temperature", 98.6f);
CustomInstrumentation.Set("count", 42L);
// Set array attributes
CustomInstrumentation.SetStringList("tags", new[] { "api", "v2", "production" });
CustomInstrumentation.SetLongList("user.ids", new[] { 1L, 2L, 3L });
CustomInstrumentation.SetIntegerList("scores", new[] { 100, 95, 87 });
CustomInstrumentation.SetDoubleList("metrics", new[] { 1.1, 2.2, 3.3 });
CustomInstrumentation.SetFloatList("temperatures", new[] { 98.6f, 99.1f, 97.8f });
CustomInstrumentation.SetBooleanList("flags", new[] { true, false, true });
Automatic Key Prefixing
All attribute keys are automatically prefixed with apm.:
CustomInstrumentation.Set("user.id", 12345);
// Actual key set on span: "apm.user.id"
CustomInstrumentation.Set("apm.user.name", "John");
// Key already has prefix, so it remains: "apm.user.name"
Error Handling
try
{
CustomInstrumentation.Set("user.id", 12345);
}
catch (InvalidAttributeKeyException ex)
{
// Invalid key format
Console.WriteLine($"Invalid key: {ex.Message}");
}
catch (InvalidAttributeValueException ex)
{
// Invalid value (null, NaN, Infinity, etc.)
Console.WriteLine($"Invalid value: {ex.Message}");
}
catch (SpanAttributeException ex)
{
// No active span or span error
Console.WriteLine($"Span error: {ex.Message}");
}
📋 Supported Types
Scalar Types
bool- Boolean valuesint- Integer values (converted to long)long- Long integer valuesfloat- Float values (converted to double)double- Double precision valuesstring- String values (cannot be null)
Array Types
bool[]- Boolean arraysint[]- Integer arrays (converted to long[])long[]- Long integer arraysfloat[]- Float arrays (converted to double[])double[]- Double precision arraysstring[]- String arrays (null values filtered out)
⚙️ Validation Rules
Key Validation
- ✅ Cannot be null or empty
- ✅ Only alphanumeric characters and dots allowed
- ✅ Automatically converted to lowercase
- ✅ Automatically prefixed with
apm.
Value Validation
- ✅ String values cannot be null
- ✅ Double/Float values cannot be NaN or Infinity
- ✅ Arrays cannot be null or empty
- ✅ Null values in arrays are automatically filtered out
- ✅ Invalid values (NaN, Infinity) in arrays are filtered out
🌍 Platform Support
| Platform | Supported Frameworks |
|---|---|
| Windows | .NET Framework 4.6.2, 4.7, 4.8<br>.NET 8, .NET 9 |
| Linux | .NET 8, .NET 9<br>.NET Standard 2.0 |
| macOS | .NET 8, .NET 9<br>.NET Standard 2.0 |
📖 API Reference
Scalar Methods
Set(string key, bool value)Set(string key, int value)Set(string key, long value)Set(string key, float value)Set(string key, double value)Set(string key, string value)
Array Methods
SetBooleanList(string key, bool[] value)SetIntegerList(string key, int[] value)SetLongList(string key, long[] value)SetFloatList(string key, float[] value)SetDoubleList(string key, double[] value)SetStringList(string key, string[] value)
🔒 License
Proprietary - Copyright (c) Motadata 2026. All rights reserved.
📞 Support
For issues, questions, or support:
- Email: engg@motadata.com
- Website: https://www.motadata.com
📝 Notes
This is a TEST VERSION for evaluation purposes. For production use, please contact Motadata.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 is compatible. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- System.Diagnostics.DiagnosticSource (>= 8.0.0)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.7
- System.Diagnostics.DiagnosticSource (>= 8.0.0)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.8
- System.Diagnostics.DiagnosticSource (>= 8.0.0)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.0
- System.Diagnostics.DiagnosticSource (>= 8.0.0)
-
net8.0
- System.Diagnostics.DiagnosticSource (>= 8.0.0)
-
net9.0
- System.Diagnostics.DiagnosticSource (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|
TEST VERSION v1.0.0 - Custom instrumentation utility for OpenTelemetry spans (Testing on personal account)