question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamically updating config (for extensions in my case)

See original GitHub issue

Is your feature request related to a problem? Please describe. I’d like to be able to update the configuration of application insights after it has already been initialized. I’ve wrapped the package in an Angular Library using APP_INITIALIZER so using ai is much more straight forward for my team. The only issue is that something like the Angular plugin requires to run an init step. Not really compatible with passing config using forRoot({...})

Describe the solution you’d like I’d like to be able to do something like

addExtension(extension: ITelemetryPlugin, config?: { [extKey: string]: { [configKey: string]: any } }): void {
        const extensions = [...this.config.extensions, extension];
        this.config = { ...this.config, extensions };

        let extensionConfig = this.config.extensionConfig;
        if (config) {
            extensionConfig = { ...extensionConfig, config };
        }

        this.appInsights = new ApplicationInsights({
            config: this.config
        });
        this.appInsights.reLoadAppInsights();  // <--- new function to update config
    }

Running the above code of course errors out with

ERROR Error: Core should not be initialized more than once

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
MSNevcommented, Nov 16, 2020

Hi @mikecabana, yes 100% agree, this is one of the enhancements that we will be looking at creating next year (based on current planning). It may not be exactly as you have described, but the high level design is

  • Enable updating / reconfiguring of plugins (and core) after initialization
  • As part of this Investigate potential for dynamically (late loading) of additional plugins after initialization (ideally, this will get included, but needs to be investigated first)

We can’t commit to a timeframe just yet as there are some other largish features ahead of this work and this has implications on minification / tree shaking efforts (i.e. it’s going to add more code)

1reaction
MSNevcommented, Apr 15, 2022

An update on progress, we originally intended to deliver this as part of the next release v2.8.0 but because of the size of the changes required the next release will only partial support this.

Simplistically, v2.8.0 is going to support completely unloading and re-initializing the SDK (not ideal but a start) and we are planning that the next major release (v3.0.0) will include full support to dynamically update the config on the fly.

Timeline wise apart from bug fixes to the 2.8.0 lineage 3.x will be the next release that we will start working on (initially in the beta branch).

One other planned change to 3.x is that we are currently intending to drop ES3 (IE8) support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use dynamic configuration using push refresh in a .NET Core ...
In this tutorial, you learn how to dynamically update the configuration data for .NET Core apps using push refresh.
Read more >
microsoft/refreshing-config: Configuration library that ... - GitHub
Configuration library that can dynamically refresh configuration values. Usage. Construct your configuration store; Instantiate an instance of RefreshingConfig ...
Read more >
How to enable Dynamic Categories Extension in Magento 2?
1. Enable the extension in order to be able to create dynamic categories. 2. Enter the Product Key which you can find in...
Read more >
How to create dynamic configuration files using Ansible ...
Ansible templates extend your ability to configure applications quickly and easily. This example uses a template to configure Vim.
Read more >
Extension configuration — envoy 1.25.0-dev-a95421 ...
Extension configuration can be supplied dynamically from an xDS management server using ExtensionConfiguration discovery service. The name field in the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found