Skip to content

Commit 79138f3

Browse files
authored
Web engine (#217)
* Changing to webEngine * Removing error * Adding CPP * Adding Otel CPP Version * Rectifying TestCase * cpp add * changing to cpp
1 parent 7d108cd commit 79138f3

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

instrumentation/otel-webserver-module/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ project.ext {
3939
props.load(new FileInputStream(file("version.properties")))
4040
moduleVersion = props.get("server-module-version")
4141
moduleRelease = props.get("release")
42+
cppSDKVersion = props.get("CPP-SDK-version")
4243
moduleName = "WebServer Module"
4344
buildType = "Release Build"
4445
fullVersion = "${moduleName} ${moduleVersion} ${moduleRelease} ${headSHA1}: ${buildType}"
@@ -87,6 +88,7 @@ task generateModuleVersionHeader(type: Copy) {
8788
headSHA1: headSHA1,
8889
moduleVersion: moduleVersion,
8990
moduleRelease: moduleRelease,
91+
cppSDKVersion: cppSDKVersion,
9092
fullVersion: fullVersion)
9193
}
9294

@@ -100,6 +102,7 @@ task generateVersionFile(type: Copy) {
100102
headSHA1: headSHA1,
101103
moduleVersion: moduleVersion,
102104
moduleRelease: moduleRelease,
105+
cppSDKVersion: cppSDKVersion,
103106
fullVersion: fullVersion)
104107
}
105108

instrumentation/otel-webserver-module/include/core/sdkwrapper/SdkConstants.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ namespace sdkwrapper {
2222
const std::string kServiceName = "service.name";
2323
const std::string kServiceNamespace = "service.namespace";
2424
const std::string kServiceInstanceId = "service.instance.id";
25-
const std::string kOtelLibraryName = "telemetry.sdk.language";
26-
const std::string kOtelLibraryVersion = "telemetry.sdk.version";
25+
const std::string kOtelWebEngineName = "webengine.name";
26+
const std::string kOtelWebEngineVersion = "webengine.version";
27+
const std::string kOtelWebEngineDescription = "webengine.description";
2728
const std::string kHttpErrorCode = "HTTP ERROR CODE:";
2829
const std::string kAttrHTTPServerName = "http.server_name";
2930
const std::string kAttrHTTPMethod = "http.method";

instrumentation/otel-webserver-module/src/core/sdkwrapper/SdkHelperFactory.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,17 @@ SdkHelperFactory::SdkHelperFactory(
6666

6767
// NOTE : resource attribute values are nostd::variant and so we need to explicitely set it to std::string
6868
std::string libraryVersion = MODULE_VERSION;
69+
std::string cppSDKVersion = CPP_SDK_VERSION;
6970

7071
// NOTE : InstrumentationLibrary code is incomplete for the otlp exporter in sdk.
7172
// So, we need to pass libraryName and libraryVersion as resource attributes.
7273
// Ref : https://github.com/open-telemetry/opentelemetry-cpp/blob/main/exporters/otlp/src/otlp_recordable.cc
73-
attributes[kOtelLibraryName] = config->getOtelLibraryName();
74-
attributes[kOtelLibraryVersion] = libraryVersion;
74+
75+
//Library was changed to webengine to comply with specs https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/webengine.md
76+
attributes[kOtelWebEngineName] = config->getOtelLibraryName();
77+
//attributes[kOtelWebEngineVersion] = libraryVersion;
78+
79+
//attributes[kOtelWebEngineDescription] = config->getOtelLibraryName() + " Instrumentation";
7580

7681
auto exporter = GetExporter(config);
7782
auto processor = GetSpanProcessor(config, std::move(exporter));
@@ -84,9 +89,9 @@ SdkHelperFactory::SdkHelperFactory(
8489
std::move(sampler)
8590
));
8691

87-
mTracer = mTracerProvider->GetTracer(config->getOtelLibraryName(), libraryVersion);
92+
mTracer = mTracerProvider->GetTracer("cpp", cppSDKVersion);
8893
LOG4CXX_INFO(mLogger,
89-
"Tracer created with LibraryName: " << config->getOtelLibraryName() <<
94+
"Tracer created with LibraryName: " << "cpp" <<
9095
" and LibraryVersion " << libraryVersion);
9196

9297
// Adding trace propagator

instrumentation/otel-webserver-module/src/module_version_template.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55
#define MODULE_VERSION_ "$moduleVersion"
66
#define RELEASE_ "$moduleRelease"
77
#define FULL_MODULE_VERSION_ "$fullVersion"
8+
#define CPP_SDK_VERSION_ "$cppSDKVersion"
89

910
static const char MODULE_VERSION[] =
1011
MODULE_VERSION_ RELEASE_ MODULE_SHA1;
1112

1213
static const char FULL_MODULE_VERSION[] =
1314
FULL_MODULE_VERSION_;
1415

16+
static const char CPP_SDK_VERSION[] =
17+
CPP_SDK_VERSION_;
18+
1519
#endif
1620

instrumentation/otel-webserver-module/test/integration/src/test/java/restutils/ValidationUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void verifyAllTraces() {
3333
}
3434
Assert.assertTrue(span.getJSONObject("tags").get("service.namespace").toString().contentEquals("sample_namespace"));
3535
Assert.assertTrue(span.getJSONObject("localEndpoint").get("serviceName").toString().contentEquals("demoservice"));
36-
Assert.assertTrue(span.getJSONObject("tags").get("telemetry.sdk.language").toString().contentEquals("Apache"));
36+
Assert.assertTrue(span.getJSONObject("tags").get("telemetry.sdk.language").toString().contentEquals("cpp"));
3737
}
3838
}
3939

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
server-module-version=1.0.0
22
release=GA
33
nginxSupportedVersions=1.22.0,1.23.0,1.23.1
4+
CPP-SDK-version=1.2.0

0 commit comments

Comments
 (0)