Blog Post

Apps on Azure Blog
3 MIN READ

Part III: OTEL sidecar extension on Azure App Service for Linux - Language cheat-sheet

TulikaC's avatar
TulikaC
Icon for Microsoft rankMicrosoft
Nov 13, 2025

Building on Part II (and Part I), here’s a concise matrix for PHP, Python, Node.js, and .NET, plus the key app settings and quick troubleshooting steps. 

 

Lang docOTEL librariesAppSettingsStartup command exampleSample repo
PHP
Composer autoloader (vendor/autoload.php); 

PECL ext opentelemetry via php.ini (extension=opentelemetry.so); Composer plugins (e.g., Slim, PSR-18).
Main: OTEL_PHP_AUTOLOAD_ENABLED=true, SCM_DO_BUILD_DURING_DEPLOYMENT=true, OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318 

Sidecar: map OTEL_PHP_AUTOLOAD_ENABLED
cp /home/site/wwwroot/default /etc/nginx/sites-enabled/default && nginx -s reload && bash /home/site/wwwroot/startup.sh (startup.sh: pecl install opentelemetry; add extension=opentelemetry.so; php-fpm)
PHP Sample
Python
Via opentelemetry-instrument wrapper; auto-patches Flask/requests; installed with pip; run app through opentelemetry-instrument.
Main: OTEL_TRACES_EXPORTER=otlp, OTEL_METRICS_EXPORTER=otlp, OTEL_LOGS_EXPORTER=otlp, OTEL_PYTHON_LOGGING_AAUTO_INSTRUMENTATION_ENABLED
=true,
SCM_DO_BUILD_DURING_DEPLOYMENT=true
Sidecar: map OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED
bash startup.sh (wait for pip install -r requirements.txt; then exec opentelemetry-instrument --traces_exporter otlp --metrics_exporter otlp flask run --host=0.0.0.0 --port=8000)
Python Sample
Node
npm: @opentelemetry/sdk-node, @opentelemetry/auto-instrumentations-node, @opentelemetry/exporter-trace-otlp-http; init in tracing.js; preload via --require or NODE_OPTIONS.

 
Main: OTEL_TRACES_EXPORTER=otlp, OTEL_METRICS_EXPORTER=otlp, OTEL_LOGS_EXPORTER=otlp, SCM_DO_BUILD_DURING_DEPLOYMENT=true
 
node --require ./tracing.js <your-app>.js (or set NODE_OPTIONS=--require ./tracing.js and use normal start)
Node Sample
 Dotnet
NuGet packages (OpenTelemetry.Extensions.Hosting, OpenTelemetry.Instrumentation
.AspNetCore, OpenTelemetry.Instrumentation.Http, OpenTelemetry.Exporter
.OpenTelemetryProtocol); configure in Program.cs via AddOpenTelemetry() (ASP.NET Core + HttpClient).
 
Main: OTEL_DOTNET_AUTO_TRACES_ENABLED=true, OTEL_DOTNET_AUTO_METRICS_ENABLED=true, OTEL_DOTNET_AUTO_LOGS_ENABLED=true
 
No custom startup command needed
.NET Sample

 

Common App Settings added by default

Azure Monitor (Application Insights)

APPLICATIONINSIGHTS_CONNECTION_STRING = <your-application-insights-connection-string>
OTEL_EXPORTER = azuremonitor
OTEL_EXPORTER_OTLP_ENDPOINT = http://127.0.0.1:4318
OTEL_SERVICE_NAME = <your-app-name>

 

Elastic APM

ELASTIC_APM_ENDPOINT = https://<your-elastic-endpoint>
ELASTIC_APM_SECRET_TOKEN = <your-elastic-token>
OTEL_EXPORTER = elastic
OTEL_EXPORTER_OTLP_ENDPOINT = http://127.0.0.1:4318
OTEL_SERVICE_NAME = <your-app-name>

 

Notes:

  • These live on the main app; the sidecar extension reads what it needs and forwards data to the chosen backend.
  • Keep :4318 for OTLP/HTTP (default). Use :4317 only if you switch to OTLP/gRPC across your stack.
  • Set a meaningful OTEL_SERVICE_NAME (e.g., myapp-api) to make traces easy to find.

Sample repo (code & containers)

We’ve published a repo with working samples for PHP, Node.js, Python, and .NET showing both code-based and container-based setups using the OTEL sidecar extensions. Use it as your starting point: https://github.com/Azure-Samples/sidecar-samples/tree/main/otel-sidecar

Troubleshooting

No telemetry appearing

  • Sidecar status: Deployment Center → Containers → confirm the sidecar shows Running.
  • Settings check: Environment variables → confirm
    OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318 and your backend creds (e.g., APPLICATIONINSIGHTS_CONNECTION_STRING or ELASTIC_APM_ENDPOINT/ELASTIC_APM_SECRET_TOKEN).
  • Logs: Monitoring → Log stream → view the sidecar container logs for errors or “Successfully exported” messages.
  • Debug logs: Add OTEL_TELEMETRY_LOG_LEVEL=debug in App settings, Apply, then re-check Log stream.

Sidecar fails to start

  • Requirements: Confirm your plan has sufficient resources (e.g., P0v3 or higher).
  • Required settings present:
    • Azure Monitor: APPLICATIONINSIGHTS_CONNECTION_STRING
    • Elastic: ELASTIC_APM_ENDPOINT, ELASTIC_APM_SECRET_TOKEN
  • Startup errors: Monitoring → Log stream → check sidecar startup logs for config issues.

High memory usage

  • Reduce volume: Enable sampling, filter health checks/noisy endpoints, lower log verbosity.
  • Scale up: Settings → Scale up (App Service plan) → choose a higher tier.

Conclusion & resources

With the OpenTelemetry sidecar extensions for Azure Monitor and Elastic APM, App Service for Linux makes end-to-end observability a drop-in add-on for both code and container apps. Grab the sample repo, wire up your connection string or token, and give it a try.

Updated Nov 13, 2025
Version 2.0
No CommentsBe the first to comment