-
Notifications
You must be signed in to change notification settings - Fork 4
Add node.js app insights package #64
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
Merged
zhiyuanliang-ms
merged 9 commits into
preview
from
zhiyuanliang/app-insights-node-package
Nov 8, 2024
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6b16e60
init
zhiyuanliang-ms 8fa989a
add node.js package
zhiyuanliang-ms 0c6a3b3
fix lint
zhiyuanliang-ms cdbb872
add exp telemetry fields
zhiyuanliang-ms e9a00c4
Merge branch 'preview' of https://github.com/microsoft/FeatureManagem…
zhiyuanliang-ms f04b8bd
update
zhiyuanliang-ms fc961af
update
zhiyuanliang-ms eb4c866
Merge branch 'preview' of https://github.com/microsoft/FeatureManagem…
zhiyuanliang-ms 60a9185
align with other FM to produce True/False instead of true/false
zhiyuanliang-ms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| { | ||
| "env": { | ||
| "browser": true, | ||
zhiyuanliang-ms marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "commonjs": true, | ||
| "es2021": true, | ||
| "node": true, | ||
| "mocha": true | ||
| }, | ||
| "extends": [ | ||
| "eslint:recommended", | ||
| "plugin:@typescript-eslint/recommended" | ||
| ], | ||
| "ignorePatterns": [ | ||
| ], | ||
| "overrides": [ | ||
| { | ||
| "env": { | ||
| "node": true | ||
| }, | ||
| "files": [ | ||
| ".eslintrc.{js,cjs}" | ||
| ], | ||
| "parserOptions": { | ||
| "sourceType": "script" | ||
| } | ||
| } | ||
| ], | ||
| "parser": "@typescript-eslint/parser", | ||
| "parserOptions": { | ||
| "ecmaVersion": "latest" | ||
| }, | ||
| "plugins": [ | ||
| "@typescript-eslint" | ||
| ], | ||
| "rules": { | ||
| "quotes": [ | ||
| "error", | ||
| "double", | ||
| { | ||
| "avoidEscape": true | ||
| } | ||
| ], | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
| "eol-last": [ | ||
| "error", | ||
| "always" | ||
| ], | ||
| "no-trailing-spaces": "error", | ||
| "space-before-blocks": [ | ||
| "error", | ||
| "always" | ||
| ], | ||
| "no-multi-spaces": "error", | ||
| "no-multiple-empty-lines": [ | ||
| "error", | ||
| { | ||
| "max": 1 | ||
| } | ||
| ], | ||
| "semi": ["error", "always"] | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) Microsoft Corporation. | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Microsoft Feature Management Application Insights Plugin for Browser | ||
|
|
||
| Feature Management Application Insights Plugin for Browser provides a solution for sending feature flag evaluation events produced by the Feature Management library. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Node.js LTS version | ||
|
|
||
| ### Usage | ||
|
|
||
| ``` javascript | ||
| import appInsights from "applicationinsights"; | ||
| import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microsoft/feature-management"; | ||
| import { trackEvent, publishTelemetry } from "@microsoft/feature-management-applicationinsights-node"; | ||
|
|
||
| appInsights.setup(CONNECTION_STRING) | ||
| .start(); | ||
|
|
||
| const publishTelemetry = createTelemetryPublisher(appInsights.defaultClient); | ||
| const provider = new ConfigurationObjectFeatureFlagProvider(jsonObject); | ||
| const featureManager = new FeatureManager(provider, {onFeatureEvaluated: publishTelemetry}); | ||
|
|
||
| // FeatureEvaluation event will be emitted when a feature flag is evaluated | ||
| featureManager.getVariant("TestFeature", {userId : TARGETING_ID}).then((variant) => { /* do something*/ }); | ||
|
|
||
| // Emit a custom event with targeting id attached. | ||
| trackEvent(appInsights.defaultClient, TARGETING_ID, {name: "TestEvent"}); | ||
| ``` | ||
|
|
||
| ## Contributing | ||
|
|
||
| This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
| Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
| the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. | ||
|
|
||
| When you submit a pull request, a CLA bot will automatically determine whether you need to provide | ||
| a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions | ||
| provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
|
||
| This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
| For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
| contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. | ||
|
|
||
| ## Trademarks | ||
|
|
||
| This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft | ||
| trademarks or logos is subject to and must follow | ||
| [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). | ||
| Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. | ||
| Any use of third-party trademarks or logos are subject to those third-party's policies. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.