OpenTelemetry
#!/bin/bash
if [ $# -ne 3 ]; then
echo "Usage: ./setup.sh [servicename] [endpoint] [logginglevel]"
echo Example : ./setup.sh http://collector debug
exit 1
fi
export OTEL_SERVICE_NAME=$1
export OTEL_LOG_LEVEL=$3
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=$2:4318
export OTEL_INSTRUMENTATION_OSHI_EXPERIMENTAL_METRICS_ENABLED=true
export OTEL_INSTRUMENTATION_RUNTIME_TELEMETRY_EMIT_EXPERIMENTAL_TELEMETRY=true
export OTEL_INSTRUMENTATION_HTTP_CLIENT_CAPTURE_REQUEST_HEADERS=Authorization,Cookie
export OTEL_INSTRUMENTATION_HTTP_SERVER_CAPTURE_REQUEST_HEADERS=Authorization,Cookie
Usage :
`./setup.sh [servicename] [endpoint] [logginglevel]`
+ __[servicename]__: service name.
+ __[endpoint]__ : url of Nudge Exporter (OTEL Collector).
+ __[logginglevel]__ : log level. Possible values : error, warn, info, debug, trace. Default value : info.
OSHI Core allows you to retrieve the “memory” metrics displayed in the Service/System tab.
Version 5.3.1 and above supported.
In pom.xml, add the required dependencies:
<!-- opentelemetry-->
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-oshi</artifactId>
<version>0.16.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>5.3.1</version>
</dependency>
In the Java application entry point, add the recording of metric observers.
import io.opentelemetry.instrumentation.oshi.ProcessMetrics;
import io.opentelemetry.instrumentation.oshi.SystemMetrics;
public static void main(String[] args) {
/*
* ...
*/
SystemMetrics.registerObservers();
ProcessMetrics.registerObservers();
}
java -javaagent:path/to/opentelemetry-javaagent.jar -jar myapp.jar
OpenTelemetry .NET automatic instrumentation should work with all officially supported operating systems and versions of .NET. The minimum supported version of .NET Framework is 4.6.2. The following processor architectures are supported: x86 AMD64 (x86-64) ARM64 (experimental)
We will be using OpenTelemetry v1.14.0.
Import-Module ./env.psm1Install-OpenTelemetryCore. This installs the OpenTelemetry files (v1.14.0) in the Program Files folder by default.WARNING : this command will reset IIS. Register-OpenTelemetryForIIS -OTelServiceName <service_name> -AppPoolName <app_pool_name> -OtelExporterOtlpEndpoint <endpoint_url> where <service_name> refers to the service name, <app_pool_name> is the name of the application pool in IIS, and <endpoint_url> is the URL of the otelcol collector (http://localhost:4318).
To verify that the environment variables have been set correctly: Open IIS. Go to the pool associated with the application, then select “Configuration Editor” and “Browse Configuration” (wait for the page to load). Open the configuration file (ApplicationHost.config or web.config) and verify that the environment variables have been set correctly (use the file env_vars.txt).
<app_id> with the application ID you retrieved from your application on Nudge (type should be DOTNET). Replace <otel_service_name> with the <service_name> provided in the previous step. attributes/dotnetapp:
actions:
- action: insert
key: nudge_application_id
value: <app_id>
include:
# strict ou regexp
match_type: strict
# The Span service name must be equal to "petclinic"
resources:
- key: service.name
value: <otel_service_name>
- key: telemetry.sdk.language
value: dotnet
transform/dotnetapp:
error_mode: ignore
metric_statements:
- context: datapoint
statements:
- set(attributes["nudge_application_id"], "<app_id>")
where resource.attributes["service.name"] == "<otel_service_name>" and resource.attributes["telemetry.sdk.language"] == "dotnet"
nudgehttp:
endpoint: https://apm.atakama-technologies.com/
pathCollect: collect/rawdata
level: Warn
./otelcol.exe --config=file:./config.yaml --feature-gates=service.profilesSupport<uls_log_path> with the path to the logs generated by SharePoint. Default: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\LOGS*.log. Verify that this path exists.
```
uls:
include:
#, uls] in the section
service:
pipelines:
logs:
receivers:
receivers: [otlpnudge] #, uls]
The logs for the Nudge exporter (otelcol) are located in the folder where it was run.
OpenTelemetry logs are located in:
Import-Module ./env.psm1
- Uninstall-OpenTelemetryCore
- Unregister-OpenTelemetryForIIS --AppPoolName=<app_pool_name> where <app_pool_name> is the name of the pool specified during the installation of OpenTelemetry.