Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable applications to report what features are being used, what were the states during a request, etc... #3

Open
jimmyca15 opened this issue Jul 3, 2019 · 8 comments
Assignees

Comments

@jimmyca15
Copy link
Member

Currently feature management can be used to gate application functionality behind features. An important part of this flow is measuring how often these features are being used, and whether these features are healthy. The feature management interfaces lack the ability to extrapolate data such as what features were accessed during their request and what are their states. This should be added.

@kevinv53
Copy link

kevinv53 commented May 7, 2023

Is there any update on this?

There is Azure Monitoring and Cost Analysis but I'm not sure that those cover what is requested on this ticket.

@jimmyca15
Copy link
Member Author

Hello @kevinv53 this is the issue that we are currently designing a solution for. The current line of thought is to have an interface that is internally invoked whenever a flag is evaluated.

Exact interface and naming TBD, but something along the lines of the following:

ITelemetryPublisher
{
    ValueTask Publish(EvaluationResult result, CancellationToken cancellationToken);
}

public class EvaluationResult
{
    string FeatureName { get; set; }

    bool Enabled { get; set; }
}

It allows one to implement ITelemetryPublisher and emit/persist feature flag evaluations wherever desired.

@jimmyca15
Copy link
Member Author

Added in preview branch

#259

#281

@amis92
Copy link

amis92 commented Oct 25, 2023

I am excited for the work done in this area, however seeing the ITelemetryPublisher I couldn't help but wonder, why was DiagnosticSource not used? It seems like a perfect fit for this purpose. I'd even consider ActivitySource usage since some feature evaluations can be complex and even hit external dependencies, and having distributed tracing support for such cases could be very helpful. And these are native, runtime built-in solutions for exactly that purpose. ApplicationInsights integration with DiagnosticSource would be a breeze (it's how appins creates RequestTelemetry), and it'd also make it easy to integrate with any and all other OTel-based components nearly out of the box.

I think this was essentially what was asked for in #219

Would you still consider working in that direction, or is ITelemetryPublisher definitely your last word in this area?

@jimmyca15
Copy link
Member Author

@amis92

Can't an implementation of ITelemetryPublisher be made to satsify what you have suggested?

@amis92
Copy link

amis92 commented Oct 25, 2023

It can, but that doesn't make a lot of sense to me - as I see it, the TelemetryPublisher is a custom solution duplicating existing framework component. I don't see what's the benefit doing it this way instead of framework-standard. As a bonus, there'd be less public API surface, less maintenance, and more possible optimizations from using framework code.

@jimmyca15
Copy link
Member Author

@amis92

From my understanding DiagnosticSource doesn't play as well as we'd like with DI to put us where we want to be for this enhancement. I'm not aware of any patterns to have diagnostic source listeners be DI aware. This makes it a bit difficult to work with in our case given the libraries focus on DI usage.

See current proposed usage in Application Insights publisher example:

builder.Services.AddFeatureManagement()
    .AddTelemetryPublisher<ApplicationInsightsTelemetryPublisher>();

I appreciate any thoughts you have on the topic.

@amis92
Copy link

amis92 commented Nov 30, 2023

It seems there's now IMeterFactory which satisfies the Dependency Injection scenario :) https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.metrics.imeterfactory?view=net-8.0

It'd be helpful if the framework-based solutions could work more-or-less out of the box, instead of depending on an Azure-focused extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants