Link Search Menu Expand Document Documentation Menu

OTel APM service map processor

The otel_apm_service_map processor analyzes OpenTelemetry (OTel) trace spans to automatically generate Application Performance Monitoring (APM) service map relationships and metrics. It creates structured events that can be visualized as service topology graphs, showing how services communicate with each other and detailing their performance characteristics.

The otel_apm_service_map processor provides all the functionality of the existing service_map processor while offering enhanced observability capabilities. In addition to generating service maps, it creates time-based service maps that capture how relationships between services evolve over time rather than producing a static representation.

The processor also automatically generates Rate, Errors, and Duration (RED) metrics for each service, delivering immediate insight into service health and performance without requiring additional configuration.

Configuration

The following table describes the options you can use to configure the otel_apm_service_map processor.

Option Required Type Description
window_duration No Duration The fixed time window during which APM service map relationships are evaluated. Supports ISO-8601 duration format (for example, PT60S or PT1M) or simple integer values (interpreted as seconds). Default is 60s.
db_path No String The directory in which the processor creates database files that store transient data off heap when processing APM service map data. Default is data/otel-apm-service-map/.
group_by_attributes No List A list of OTel resource attribute names to copy into Service.groupByAttributes when they are present in a span’s resource attributes. This setting applies only to primary Service objects and not to dependency services. Default is an empty list.
metric_timestamp_source No String The source of the timestamp assigned to emitted metrics and service map events. Valid values are arrival_time and span_end_time. When set to arrival_time, the processor uses the time at which it evaluates the window, so all spans in a window share one timestamp. When set to span_end_time, the processor uses the end time of each span. Spans that arrive late can then produce data points that have the same timestamp as data points already written, which metrics backends such as Prometheus can reject. If a span has no valid end time, the processor uses the evaluation time. Default is arrival_time.
metric_timestamp_granularity No String The time unit to which the timestamps of emitted metrics and service map events are truncated. Valid values are seconds and minutes. Default is seconds.
dependency_nodes No Object Configures how the processor creates nodes for databases, message brokers, and external endpoints that do not emit their own spans. See Dependency nodes.

Dependency nodes

A dependency node represents a downstream component that a service calls but that does not emit its own SERVER span, such as a database, a message broker, or an external endpoint. The processor creates dependency nodes from the spans of the calling service and generates RED metrics for them. Each dependency node has one of the following types:

  • database: Created from a CLIENT span that contains database (db.*) attributes and has no child SERVER span.
  • external: Created from a CLIENT span that contains HTTP, RPC, or peer attributes and has no child SERVER span.
  • messaging: Created from a PRODUCER or CONSUMER span. The broker node connects producers to consumers.

The processor does not create an external node for a peer if the peer host is unresolved, is an IP address or a loopback address, or matches a pattern in hostname_denylist_patterns. For a database node, such a host is left out of the node name, which then uses <db.system>:<db.namespace> or <db.system>.

The processor creates dependency nodes only from spans in the OpenTelemetry format. If you use the otel_trace_source source, set its output_format to otel. With the default opensearch format, the processor generates service metrics but no dependency nodes.

If your version of OpenSearch Dashboards does not support dependency nodes, it lists them as services. In this case, set enabled to false.

You can configure the following options in the dependency_nodes object.

Option Required Type Description
enabled No Boolean Whether to create dependency nodes. When set to false, the processor does not create nodes for components that do not emit their own spans. Default is true.
max_dependencies_per_service No Integer The maximum number of distinct dependencies that a single source service can hold. A dependency that a service already holds remains admitted in later windows. When the limit is reached, free slots go to the new dependencies that have the most calls in the window, and calls to the remaining dependencies are grouped into an overflow node named OtherDatabase, OtherExternal, or OtherMessaging, depending on the dependency type. A dependency that is not seen for more than 10 consecutive windows releases its slot. Must be at least 1. Default is 100.
max_remote_operations_per_service No Integer The maximum number of distinct dependency remote operations that a single source service can hold. Operations are admitted and released in the same way as dependencies. When the limit is reached, calls to the remaining operations are grouped into an operation named OtherRemoteOperation. Must be at least 1. Default is 100.
hostname_denylist_patterns No List A list of regular expressions matched against the host name of a dependency. Matching is case insensitive, and a pattern must match the entire host name. The processor does not create a node for a host that matches any pattern. Setting this option replaces the default list. By default, the list contains patterns that match host names derived from IP addresses, such as Amazon EC2 host names (ip-10-0-0-5.ec2.internal or ec2-1-2-3-4.compute-1.amazonaws.com) and Kubernetes pod DNS names (10-0-0-5.ns.pod.cluster.local).

The following example sets custom limits and a custom host name denylist:

processor:
  - otel_apm_service_map:
      dependency_nodes:
        enabled: true
        max_dependencies_per_service: 50
        max_remote_operations_per_service: 200
        hostname_denylist_patterns:
          - '^ip-\d{1,3}-\d{1,3}-\d{1,3}-\d{1,3}(\..*)?$'
          - '^egress-proxy$'

Usage

entry-pipeline:
   source:
     otel_trace_source:
       path: "/test/path"
   sink:
     - pipeline:
         name: "raw-pipeline"
     - pipeline:
         name: "service-map-pipeline"
raw-pipeline:
   source:
     pipeline:
       name: "entry-pipeline"
   processor:
     - otel_trace_raw:
   sink:
     - opensearch:
         hosts: [<host>]
         index_type: trace-analytics-raw
service-map-pipeline:
   source:
     pipeline:
       name: "entry-pipeline"
   processor:
     - otel_apm_service_map:
         window_duration: 60s
         db_path: "data/otel-apm-service-map/"
   sink:
     - opensearch:
         hosts: [<host>]
         index_type: trace-analytics-service-map

Metrics

The following table describes common Abstract processor metrics.

Metric name Type Description
recordsIn Counter The ingress of records to a pipeline component.
recordsOut Counter The egress of records from a pipeline component.
timeElapsed Timer The time elapsed during execution of a pipeline component, in milliseconds.

The otel_apm_service_map processor includes the following custom metrics.

Metric name Type Description
spansDbSize Gauge The total size of all three span database windows, in bytes.
spansDbCount Gauge The total number of span entries across all three span database windows.
dependencyCallsOverflowed Counter The number of calls grouped into an overflow dependency node because max_dependencies_per_service was reached. Reported only when dependency nodes are enabled.
dependencyRemoteOperationCallsOverflowed Counter The number of calls grouped into OtherRemoteOperation because max_remote_operations_per_service was reached. Reported only when dependency nodes are enabled.
350 characters left

Have a question? .

Want to contribute? or .