Comments (5)
Good discussion, guys. I am actually very glad that @xiaomi7732 reminded me of IConfiguration
because after browsing through some EventFlow tests I think what Whit wants can be made to "just work" by slightly modifying the example we have in the documentation.
- To enable getting configuration settings from environment variables, enable environment variables provider in addition to JSON file provider. So, the second line should read something like
IConfiguration config = new ConfigurationBuilder()
.AddJsonFile(configFilePath)
.AddEnvironmentVariables()
.Build();
-
For ServiceFabric it might be necessary to use
ServiceFabricDiagnosticPipelineFactory
and callApplyFabricConfigurationOverrides()
, instead of vanillaDiagnosticPipelineFactory
. If you are using ServiceFabric, you are probably using that already. -
The example shows you how to set a connection string property on an EventHub output; you would modify it to set it on the output you are using. The value will be populated by the environment provider into the root configuration, so to set it for the EventFlow output you will do something like
myOutput["connectionString"] = config["SERVICE_FABRIC_CONNECTION_STRING_VAR"];
Let us know please if this does work for you.
from diagnostics-eventflow.
If I understand it correctly, it seems like we only need to accept configurations from environment variables here.
Loop in @karolz-ms for comments.
from diagnostics-eventflow.
Hello! We do not have any plans around loading configuration data from environment variables. You can construct the EventFlow pipeline in code and use environment variables there, but then you give up on the whole configuration mechanism, so it is not a great workaround.
Adding support for reading configuration values from environment variables would be a good enhancement though, and I would probably argue for making it the core feature of EventFlow configuration, benefitting all inputs and outputs. E.g. one could say "server=${DATABASE_SERVER}"
inside the configuration document and EventFlow would use the DATABASE_SERVER
environment variable to substitute the value before the configuration setting is used. This would require some design of course, and would be a breaking change, so we would probably make it an opt-in feature.
@xiaomi7732 @WhitWaldo please share your thoughts
from diagnostics-eventflow.
Thanks for your ask Karol. Without deep investigation, based on the IConfiguration pattern established by .NET (.NET Core) over time, I am leaning toward fully leveraging it, and that opens up possibilities for all kinds of configuration providers (Env, KV, etc.).
Specific to ServiceFabric, the service fabric configuration file should be provided as an SFConfigureFileProvider
.
As a side effect, as long as the client uses IConfiguraiton
, it works.
from diagnostics-eventflow.
In my use-case, I'm pulling the event source values from Service Fabric and surfacing them in Application Insights. Right now I'm using the functionality to pull the App Insights connection string from the Service Fabric configuration so being able to opt into sourcing that from environment variables instead would allow SF to populate that variable instead itself making it all a little less exposed and easier to change centrally (e.g. from the Key Vault secret instead of in a pile of configuration files).
I'd be perfectly fine with that being an opt-in functionality.
from diagnostics-eventflow.
Related Issues (20)
- Request ability to use ConnectionString in ApplicationInsightsOutputConfiguration HOT 2
- In metric, Unable to cast object of type Int32 to type Double HOT 12
- EventFlow not working with .NET 5 HOT 3
- Upgrade Microsoft.ApplicationInsights dependencies HOT 1
- Duplicate dependencies in elastic search output HOT 3
- Update Nuget authoring when PR 387 is merged HOT 3
- .NET 4.6.1 implementation of Core assembly does not use precise clock
- Need to set proxy for ElasticSearch output HOT 6
- Shall we remove unused `Microsoft.Diagnostics.EventFlow.TableStorage`? HOT 1
- Update test platform matrix HOT 1
- Remove Nuget binary from sources HOT 1
- This repo is missing important files
- Does EventFlow supports for app in Azure Kubernetes Service? HOT 1
- Guidance when to use EventFlow? HOT 3
- Add ability to configure index format string HOT 2
- CsvHealthReporter does not output any logs HOT 1
- EventSourceInput captures System.Runtime logs as well (NET 7) HOT 12
- Superfluous dependencies to nuget packages
- Microsoft.Diagnostics.EventFlow.Outputs.StdOutput 1.7.1 depends on Microsoft.Diagnostics.EventFlow.Json which does not exist HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diagnostics-eventflow.