diff --git a/helm/examples/tracing/baremetal-otlp-http-localhost-sample.xml b/helm/examples/tracing/baremetal-otlp-http-localhost-sample.xml
new file mode 100644
index 00000000000..e430888efa5
--- /dev/null
+++ b/helm/examples/tracing/baremetal-otlp-http-localhost-sample.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/helm/hpcc/values.schema.json b/helm/hpcc/values.schema.json
index adfe9061a3d..86d2966d332 100644
--- a/helm/hpcc/values.schema.json
+++ b/helm/hpcc/values.schema.json
@@ -1170,6 +1170,20 @@
"items": {
"$ref": "#/definitions/traceExporter"
}
+ },
+ "resourceAttributes": {
+ "type": "object",
+ "properties": {
+ "deploymentEnvironment": {
+ "type": "string",
+ "description": "Name of the deployment environment (aka deployment tier) such as staging/development/production. "
+ },
+ "serviceNamespace": {
+ "type": "string",
+ "description": "Identifier used to help distinguish instances of same service"
+ }
+ },
+ "additionalProperties": { "type": ["integer", "string", "boolean"] }
}
},
"additionalProperties": { "type": ["integer", "string", "boolean"] }
diff --git a/helm/hpcc/values.yaml b/helm/hpcc/values.yaml
index b6a6d05ccba..8d6b6bed7ff 100644
--- a/helm/hpcc/values.yaml
+++ b/helm/hpcc/values.yaml
@@ -29,6 +29,8 @@ global:
tracing:
disabled: false
alwaysCreateTraceIds: true
+ resourceAttributes: # used to declare OTEL Resource Attribute config values
+ deploymentEnvironment: development # used to anotate tracing spans' environment identifier (development/production/statiging/etc)
## resource settings for stub components
#stubInstanceResources:
diff --git a/system/jlib/jtrace.cpp b/system/jlib/jtrace.cpp
index 5a88692b329..ba2dbb6d378 100644
--- a/system/jlib/jtrace.cpp
+++ b/system/jlib/jtrace.cpp
@@ -1342,6 +1342,20 @@ std::unique_ptr CTraceManager::createP
void CTraceManager::initTracerProviderAndGlobalInternals(const IPropertyTree * traceConfig)
{
+ /*
+ Service related resourceAttributes supported by otel:
+
+ service.instance.id string The string ID of the service instance.
+ service.name string Logical name of the service.
+ service.namespace string A namespace for service.name.
+ service.version string The version string of the service API or implementation.
+ */
+ opentelemetry::sdk::resource::ResourceAttributes resourceAtts =
+ {
+ {"service.name", moduleName.get()},
+ {"service.version", hpccBuildInfo.buildVersion}
+ };
+
std::vector> processors;
//By default trace spans to the logs in debug builds - so that developers get used to seeing them.
@@ -1349,6 +1363,18 @@ void CTraceManager::initTracerProviderAndGlobalInternals(const IPropertyTree * t
bool enableDefaultLogExporter = isDebugBuild();
if (traceConfig)
{
+ IPropertyTree * resourceAttributesTree = traceConfig->queryPropTree("resourceAttributes");
+ if (resourceAttributesTree)
+ {
+ const char * depEnv = resourceAttributesTree->queryProp("@deploymentEnvironment");
+ if (depEnv)
+ resourceAtts.SetAttribute("deployment.environment", depEnv);
+
+ const char * servNS = resourceAttributesTree->queryProp("@serviceNamespace");
+ if (servNS)
+ resourceAtts.SetAttribute("service.namespace", servNS);
+ }
+
//Administrators can choose to export trace data to a different backend by specifying the exporter type
Owned iter = traceConfig->getElements("exporters");
ForEach(*iter)
@@ -1369,11 +1395,6 @@ void CTraceManager::initTracerProviderAndGlobalInternals(const IPropertyTree * t
processors.push_back(opentelemetry::sdk::trace::SimpleSpanProcessorFactory::Create(std::move(exporter)));
}
- opentelemetry::sdk::resource::ResourceAttributes resourceAtts =
- {
- {"service.name", moduleName.get()},
- {"service.version", hpccBuildInfo.buildVersion}
- };
auto jtraceResource = opentelemetry::sdk::resource::Resource::Create(resourceAtts);
// Default is an always-on sampler.
@@ -1412,6 +1433,8 @@ void CTraceManager::initTracer(const IPropertyTree * traceConfig)
const char * simulatedGlobalYaml = R"!!(global:
tracing:
disabled: false
+ resourceAttributes: # used to declare OTEL Resource Attribute config values
+ deploymentEnvironment: testing
processor:
type: simple
exporter: