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.
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
feat: added support to set version dynamically based on the release #30
feat: added support to set version dynamically based on the release #30
Changes from 2 commits
220a56d
769691f
d06b234
76f18ed
f05ff2a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[curious] Were any alternatives to fetching
version.json
considered yet? I'm a bit concerned needing to fetchversion.json
at runtime as it's a network request users will need to resolve before the MFE is initialized/executed. While it wouldn't be an expensive network request to make, it still introduces a request waterfall whereversion.json
needs to be fetched before DataDog and the rest of the MFE can be initialized.For example, an alternative could be to modify the
tubular
scripts regardingFrontendBuilder
to create a new, genericAPP_VERSION
environment variable passed to thenpm run build
similar to the environment variables defined in the app config. Then, the change forDatadogLoggingService
would be to consume this new environment variable created/passed intubular
instead of introducing a network request to get the same data.If we opted for this alternative approach, the only change for
DatadogLoggingService
would be updating the environment variable used fromprocess.env.DATADOG_VERSION
to the genericAPP_VERSION
; I don't think we'd want to hardcodeDATADOG_VERSION
intubular
per se, hence the suggestion of a generically namedAPP_VERSION
instead).See this diff for what the alternative
tubular
approach might look like to mitigate the need to fetchversion.json
. With those changes, when we iterate overapp_config.items()
to generate a list of environment variables to use withnpm run build
,APP_VERSION
would also be passed whereDatadogLoggingService
could then access it.If you still wanted the ability for consumers to override the version for DataDog, then
DatadogLoggingService
could do something like:...where a custom
DATADOG_VERSION
takes precedence over the genericAPP_VERSION
.Curious to hear what you think about this alternative approach, primarily to not need to
fetch
the version.json file since that introduces a minor request waterfall that could impact frontend performance.Check warning on line 41 in src/DatadogLoggingService.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: given the required config settings check is implemented above, the
applicationId
andclientToken
properties probably don't need to fallback to an empty string since they should be expected to have a value at this point.The other fallbacks to empty strings for the other properties still makes sense, though :)