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

HPCC-30847 Allow OpenTelemetry options to be configured in bare-metal #18151

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion esp/platform/espp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ int init_main(int argc, const char* argv[])
envpt.setown(createPTreeFromXMLFile(cfgfile, ipt_caseInsensitive));

// NB: esp has no standard component config in bare-metal, this is loading defaultYaml only
espConfig.setown(loadConfiguration(defaultYaml, argv, "esp", "ESP", nullptr, nullptr));
// disable initTracing here, it will be called explicitly below after global config is replaced
espConfig.setown(loadConfiguration(defaultYaml, argv, "esp", "ESP", nullptr, nullptr, nullptr, true, false));

// legacy esp.xml will contain a generated global section if present in the environment.
// replace the empty stub created by loadConfiguration with this environment globals section.
Expand All @@ -464,6 +465,7 @@ int init_main(int argc, const char* argv[])
Owned<IPropertyTree> currentConfig = getComponentConfig();
replaceComponentConfig(currentConfig, global);
}
initTraceManager("esp", getComponentConfigSP(), getGlobalConfigSP());
}
Owned<IPropertyTree> procpt = NULL;
if (envpt)
Expand Down
16 changes: 8 additions & 8 deletions initfiles/componentfiles/configxml/esp.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@
<!--
# Generated for configuration info. accessed by getGlobalConfig()
-->
<xsl:choose>
<xsl:when test="tracing">
<xsl:copy-of select="./tracing"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="/Environment/Software/tracing"/>
</xsl:otherwise>
</xsl:choose>
<global>
<expert>
<xsl:copy-of select="/Environment/Software/Globals/@* | /Environment/Software/Globals/*"/>
Expand All @@ -86,6 +78,14 @@
<xsl:copy-of select="/Environment/Software/RemoteStorage/*"/>
</storage>
<xsl:copy-of select="/Environment/Hardware/cost"/>
<xsl:choose>
<xsl:when test="tracing">
<xsl:copy-of select="./tracing"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="/Environment/Software/tracing"/>
</xsl:otherwise>
</xsl:choose>
</global>
</xsl:copy>
</xsl:template>
Expand Down
10 changes: 5 additions & 5 deletions system/jlib/jptree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9037,7 +9037,7 @@ static std::tuple<std::string, IPropertyTree *, IPropertyTree *> doLoadConfigura
return std::make_tuple(std::string(absConfigFilename.str()), newComponentConfig.getClear(), newGlobalConfig.getClear());
}

jlib_decl IPropertyTree * loadConfiguration(IPropertyTree *componentDefault, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute, bool monitor)
jlib_decl IPropertyTree * loadConfiguration(IPropertyTree *componentDefault, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute, bool monitor, bool initTracing)
{
assertex(configFileUpdater); // NB: loadConfiguration should always be called after configFileUpdater is initialized
if (configFileUpdater->isInitialized())
Expand Down Expand Up @@ -9066,12 +9066,12 @@ jlib_decl IPropertyTree * loadConfiguration(IPropertyTree *componentDefault, con
configFileUpdater->init(std::get<0>(result).c_str(), componentDefault, argv, componentTag, envPrefix, legacyFilename, mapper, altNameAttribute);
if (monitor)
configFileUpdater->startMonitoring();

initTraceManager(componentTag, componentConfiguration.get(), globalConfiguration.get());
if (initTracing)
initTraceManager(componentTag, componentConfiguration.get(), globalConfiguration.get());
return componentConfiguration.getLink();
}

jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute, bool monitor)
jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute, bool monitor, bool initTracing)
{
if (componentConfiguration)
throw makeStringExceptionV(99, "Configuration for component %s has already been initialised", componentTag);
Expand All @@ -9087,7 +9087,7 @@ jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char
else
componentDefault.setown(createPTree(componentTag));

return loadConfiguration(componentDefault, argv, componentTag, envPrefix, legacyFilename, mapper, altNameAttribute, monitor);
return loadConfiguration(componentDefault, argv, componentTag, envPrefix, legacyFilename, mapper, altNameAttribute, monitor, initTracing);
}

void replaceComponentConfig(IPropertyTree *newComponentConfig, IPropertyTree *newGlobalConfig)
Expand Down
4 changes: 2 additions & 2 deletions system/jlib/jptree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ inline static bool isValidXPathChr(char c)
jlib_decl void mergeConfiguration(IPropertyTree & target, const IPropertyTree & source, const char *altNameAttribute=nullptr, bool overwriteAttr=true);

jlib_decl IPropertyTree * loadArgsIntoConfiguration(IPropertyTree *config, const char * * argv, std::initializer_list<const std::string> ignoreOptions = {});
jlib_decl IPropertyTree * loadConfiguration(IPropertyTree * defaultConfig, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute=nullptr, bool monitor=true);
jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute=nullptr, bool monitor=true);
jlib_decl IPropertyTree * loadConfiguration(IPropertyTree * defaultConfig, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute=nullptr, bool monitor=true, bool initTracing=true);
jlib_decl IPropertyTree * loadConfiguration(const char * defaultYaml, const char * * argv, const char * componentTag, const char * envPrefix, const char * legacyFilename, IPropertyTree * (mapper)(IPropertyTree *), const char *altNameAttribute=nullptr, bool monitor=true, bool initTracing=true);
jlib_decl void replaceComponentConfig(IPropertyTree *newComponentConfig, IPropertyTree *newGlobalConfig);
jlib_decl void initNullConfiguration();
jlib_decl IPropertyTree * getCostsConfiguration();
Expand Down
Loading