Skip to content

Add IAgent DI usage clarification in readme #3414

@pavdro-ttl

Description

@pavdro-ttl

Is your feature request related to a problem? Please describe.

When trying to register NewRelic's IAgent to use with DI I was told that Singleton is not the correct lifestyle. Apparently there was an incident and NR engineers advised to use Scoped/Transient to avoid any telemetry issues when agents refresh on the box.

This is not mentioned anywhere in the docs and when inspecting decompiled nuget package it does look like it's safe to inject IAgent as a Singleton.

Feature Description

Update readme docs and clarify how IAgent is meant to be injected and which lifestyle to use. Alternatively make it safe to inject IAgent into Singleton services or retrieve it somehow.

Additional context

There is a question on StackOverflow suggesting the wrong behaviour too which can cause more issues with NR https://stackoverflow.com/a/66543642.

Priority

Must Have

Metadata

Metadata

Assignees

No one assigned

    Labels

    communityTo tag external issues and PRs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions