Skip to content

Apache & IBM HTTP Server OpenTelemetry Web Tracing Guide

Instrument Apache HTTPD and IBM HTTP Server to emit OpenTelemetry traces.

3 min read Updated SS

This guide walks you through installing and configuring the OpenTelemetry web server module on Apache HTTP Server and IBM HTTP Server (IHS). Once instrumented, the web layer emits traces to the OpenTelemetry Collector, so HEAL can follow each request from the web tier through the application tier (instrumented by JIM) down to the database.

Using NGINX? See the NGINX OpenTelemetry Web Tracing Guide.

Prerequisites#

Before you begin, make sure the following are in place:

  • Apache HTTP Server 2.2 or 2.4, or IBM HTTP Server, is installed on the target Linux server.
  • An OpenTelemetry Collector is reachable from the web server host, and you know its host and gRPC port (typically 4317).
  • SELinux policies allow the web server to communicate with the OpenTelemetry Collector.
  • You have root (or sudo) privileges to extract files under /opt and edit the web server configuration.
  • You have the installation files opentelemetry-webserver-sdk-x64-linux.tgz and opentelemetry_module.conf, delivered with the HEAL release package (contact HEAL Support if you do not have them).
  • You have a backup of the current web server configuration (for example, httpd.conf).

Install and configure the module#

Follow the steps below on the target web server:

  1. Transfer the files. Place both opentelemetry-webserver-sdk-x64-linux.tgz and opentelemetry_module.conf onto the target server.
  2. Extract the package to the /opt directory:

    tar -xvf opentelemetry-webserver-sdk-x64-linux.tgz -C /opt
    

    This creates the installation directory /opt/opentelemetry-webserver-sdk. All paths in the remaining steps assume this location; adjust them if your setup differs.

  3. Navigate to the installation directory:

    cd /opt/opentelemetry-webserver-sdk
    
  4. Run the install script:

    ./install.sh
    
  5. Copy the configuration file into the web server configuration directory. On CentOS/RHEL this is typically /etc/httpd/conf/:

    cp opentelemetry_module.conf /etc/httpd/conf/
    
  6. Include the module configuration. Open /etc/httpd/conf/httpd.conf and add the following line at the end of the file, updating the path if you copied opentelemetry_module.conf to a different location:

    Include /etc/httpd/conf/opentelemetry_module.conf
    
  7. Load the module libraries. In opentelemetry_module.conf, load the dependent libraries with LoadFile directives, then load the Apache module itself. For Apache HTTP Server 2.4 use libmod_apache_otel.so; for Apache HTTP Server 2.2 use libmod_apache_otel22.so. For example (Apache 2.4):

    LoadFile /opt/opentelemetry-webserver-sdk/sdk_lib/lib/libopentelemetry_common.so
    LoadFile /opt/opentelemetry-webserver-sdk/sdk_lib/lib/libopentelemetry_resources.so
    LoadFile /opt/opentelemetry-webserver-sdk/sdk_lib/lib/libopentelemetry_trace.so
    LoadFile /opt/opentelemetry-webserver-sdk/sdk_lib/lib/libopentelemetry_otlp_recordable.so
    LoadFile /opt/opentelemetry-webserver-sdk/sdk_lib/lib/libopentelemetry_exporter_ostream_span.so
    LoadFile /opt/opentelemetry-webserver-sdk/sdk_lib/lib/libopentelemetry_exporter_otlp_grpc.so
    # Load the SDK
    LoadFile /opt/opentelemetry-webserver-sdk/sdk_lib/lib/libopentelemetry_webserver_sdk.so
    # Load the Apache module (use libmod_apache_otel22.so for Apache 2.2)
    LoadModule otel_apache_module /opt/opentelemetry-webserver-sdk/WebServerModule/Apache/libmod_apache_otel.so
    ApacheModuleEnabled ON
    
  8. Set up the OpenTelemetry export parameters. In the same file, configure where and how trace data is sent to the OpenTelemetry Collector. Replace each <value> placeholder with your environment's values; the ApacheModuleOtelExporterHeaders line is optional and only needed if your collector requires an authentication header:

    ApacheModuleOtelSpanExporter otlp
    ApacheModuleOtelExporterEndpoint <otel_host>:<otel_port>
    #ApacheModuleOtelExporterHeaders api-key=<password>
    ApacheModuleServiceName <service_name>
    ApacheModuleServiceNamespace <service_namespace>
    ApacheModuleServiceInstanceId <instance_id>
    

    For example:

    ApacheModuleOtelSpanExporter otlp
    ApacheModuleOtelExporterEndpoint 192.0.2.81:4317
    ApacheModuleServiceName Jim-Websphere-SRV
    ApacheModuleServiceNamespace Jim-Websphere-SRV-WebLayer
    ApacheModuleServiceInstanceId Jim-Websphere-Comp_Inst
    
  9. Verify the module is loaded. Run the following command and confirm that otel_apache_module (shared) appears in the output:

    httpd -M
    
  10. Restart the web server to apply the changes and start instrumenting requests:

    systemctl restart httpd
    

Note. IBM HTTP Server is built on Apache HTTP Server, so the module directives are identical. Copy opentelemetry_module.conf into your IHS configuration directory instead, add the Include line to the IHS httpd.conf, and restart IHS with apachectl restart from the IHS installation.

Verify traces#

Confirm end-to-end tracing is working:

  1. Generate test traffic. Send a few HTTP requests to the web server from the same host or a remote client:

    curl http://localhost/
    
  2. Check the service in HEAL. In the HEAL UI, open the service you configured (the ApacheModuleServiceName value, for example Jim-Websphere-SRV) and confirm that new web-layer traces appear for your test requests.

  3. Check trace continuity. Open a trace and verify the web-layer span connects to the downstream application-tier spans, so the full path from web server to application to database is visible in Transaction Monitoring.

Heads up. If no traces appear, confirm the collector endpoint is reachable from the web server host (host, port, and SELinux policy), and re-check that httpd -M lists otel_apache_module.

Next