Skip to content

.NET Standard library supporting custom event reporting to the NewRelic Insights product.

License

Notifications You must be signed in to change notification settings

virtualmadden/NewRelic.CustomEvents

Repository files navigation

NewRelic.CustomEvents

.NET Standard library supporting custom event reporting to the NewRelic Insights product.

Master
Build Status

Attributes

Event Attributes

[NewRelicIgnore]
Decorate class properties with this attribute if you would like them to not be included when sending a custom event to NewRelic. Restricted to class properties.

[NewRelicName("FooBar")]
Decorate classes and class properties with this attribute if you would like to rename items when sending a custom event to NewRelic. Restricted to classes and class properties.

Usage

public static void LogCustomEvent(string serviceName)
{
    new ServiceEvent(serviceName)
    {
        OperationName = "CustomEvent",
        OperationLevel = OperationLevel.System,
        OperationSuccess = true
    }.SendAsync();
}
public static void LogCustomEvent(string serviceName)
{
    new ServiceEvent(serviceName)
    {
        OperationName = "CustomEvent",
        OperationLevel = OperationLevel.System,
        OperationSuccess = false,
        ErrorMessage = "Something went wrong!"
    }.SendAsync();
}
[NewRelicName("ExtraCustomEvent")]                // Sent as an ExtraCustomEvent.
public class CustomServiceEvent : BaseEvent
{
    public CustomServiceEvent(string serviceName, Guid? requestId = null) 
    : base(serviceName, requestId) { }

    [NewRelicIgnore]
    public string Username { get; set; }    // Not sent with event.
    [NewRelicName("CustomPassword")]
    public string Password { get; set; }    // Sent as CustomPassword with event.
}

About

.NET Standard library supporting custom event reporting to the NewRelic Insights product.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages