Skip to main content

OpenTelemetry Integration

Use OpenTelemetry Collector Contrib with its Doris exporter to load application logs and traces into a VeloDB Cloud warehouse. The Collector reads files or receives OTLP from instrumented applications, processes events, and sends batches through Stream Load.

You deploy and operate the Collector outside the warehouse. This guide applies to SaaS and BYOC warehouses that the Collector can reach. It collects telemetry from your applications, rather than managed warehouse host logs.

Prerequisites​

  • A running warehouse and its Stream Load endpoint, including the required protocol, port, and TLS settings. See Connect to a warehouse.
  • A warehouse SQL user with load privileges on the destination tables. A separate user needs privileges to create the database and tables in the setup step.
  • Access to the application logs or to an application's OTLP output.
  • A Collector Contrib build that includes the Doris exporter. The examples use Collector Contrib 0.132.2 and the exporter configuration from Contrib v0.132.0.

Note:

The Doris exporter is classified upstream as alpha in this version. Test schema compatibility, retries, and load behavior with your selected Collector release before using it for production telemetry.

Install and configure the Collector​

Download the package for your platform from the Collector Contrib 0.132.2 release, then extract the otelcol-contrib executable. The core otelcol distribution does not include this exporter.

Provide these environment variables through your deployment configuration or secret mechanism:

VariableValue
VELODB_STREAM_LOAD_ENDPOINTThe warehouse Stream Load base URL with scheme and port, without /api/.... Preserve the generated HTTPS scheme when TLS is enabled.
VELODB_USERThe warehouse SQL username for ingestion.
VELODB_PASSWORDThe ingestion user's password.

The configuration files below refer to them with the Collector's ${env:VARIABLE} syntax. Use a trusted certificate authority for HTTPS endpoints. The exporter supports the Collector's HTTP and TLS client settings.

Exporter options​

OptionMeaning
endpointStream Load base URL, including the protocol and port.
databaseDestination SQL database. The examples use otel.
username, passwordWarehouse SQL credentials.
table.logs, table.traces, table.metricsDestination table names. Defaults are otel_logs, otel_traces, and otel_metrics. Metric-specific schema details depend on the metric type and exporter version.
create_schemaWhether the exporter creates schema automatically. The examples set false and create tables explicitly.
mysql_endpointMySQL address used only when create_schema is true. It is not needed for the examples.
history_daysRetention for automatically created tables. 0 means no automatic expiration. Ignored when create_schema is false.
create_history_daysHistorical partitions to create during automatic schema creation. Ignored when create_schema is false.
timezoneTime zone used by the exporter. Match it to your timestamp and partition configuration. The examples use UTC.
headersAdditional Stream Load headers as a YAML map.
log_responseWhether to log load responses. Enable it while validating the pipeline and review logs before reducing verbosity.
retry_on_failureRetry behavior, including backoff and maximum retry duration.
sending_queueExport queue configuration. Queue capacity and persistence depend on the chosen settings.
log_progress_intervalThroughput-log interval in seconds. The default is 10. A value of 0 disables these logs.

A batch processor's send_batch_size counts records or spans, rather than bytes, and is a trigger rather than a strict maximum. Tune batching with event size, freshness, collector memory, and warehouse capacity. An in-memory queue and retries do not by themselves provide durable delivery or exactly-once semantics.

Create the log table​

The log examples use the exporter's log schema, rather than a table whose columns mirror the original JSON keys. Stable telemetry fields use typed columns, log text is stored in body, and parsed attributes are stored in log_attributes.

Warning:

This table automatically drops daily partitions older than the configured 30-day window. Change dynamic_partition.start to match your retention requirement before loading production data. Historical sample files must fall within an available partition.

Run this SQL in your warehouse:

CREATE DATABASE IF NOT EXISTS otel;

CREATE TABLE IF NOT EXISTS otel.otel_logs
(
timestamp DATETIMEV2(6),
service_name VARCHAR(200),
service_instance_id VARCHAR(200),
trace_id VARCHAR(200),
span_id STRING,
severity_number INT,
severity_text STRING,
body STRING,
resource_attributes VARIANT,
log_attributes VARIANT,
scope_name STRING,
scope_version STRING,
INDEX idx_service_name(service_name) USING INVERTED,
INDEX idx_timestamp(timestamp) USING INVERTED,
INDEX idx_service_instance_id(service_instance_id) USING INVERTED,
INDEX idx_trace_id(trace_id) USING INVERTED,
INDEX idx_span_id(span_id) USING INVERTED,
INDEX idx_severity_number(severity_number) USING INVERTED,
INDEX idx_body(body) USING INVERTED PROPERTIES("parser"="unicode", "support_phrase"="true"),
INDEX idx_severity_text(severity_text) USING INVERTED,
INDEX idx_resource_attributes(resource_attributes) USING INVERTED,
INDEX idx_log_attributes(log_attributes) USING INVERTED,
INDEX idx_scope_name(scope_name) USING INVERTED,
INDEX idx_scope_version(scope_version) USING INVERTED
)
ENGINE = OLAP
DUPLICATE KEY(timestamp, service_name)
PARTITION BY RANGE(timestamp) ()
DISTRIBUTED BY RANDOM BUCKETS 10
PROPERTIES (
"compression" = "zstd",
"dynamic_partition.enable" = "true",
"dynamic_partition.create_history_partition" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "UTC",
"dynamic_partition.start" = "-30",
"dynamic_partition.end" = "1",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "10"
);

The schema is based on the versioned exporter log DDL, with explicit UTC partitions and a trial bucket count. Review bucket counts and indexes using representative data. create_schema: false leaves retention under the table's control.

Examples​

Example 1: Collect multiline text logs​

Parse application logs and combine stack traces

Use this example for Java-style logs that start with yyyy-MM-dd HH:mm:ss,SSS, followed by a severity and a message. Stack-trace lines without a timestamp are joined to the preceding event. The timestamp is interpreted as UTC. Change the parser and time zone to match your application's format.

Save the following as opentelemetry_java_log.yml. Replace /path/to/application.log with a readable file on the Collector host. For a trial, use recent events inside the table's partition window.

receivers:
filelog:
include:
- /path/to/application.log
start_at: beginning
multiline:
line_start_pattern: '^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}'
operators:
- type: regex_parser
regex: '^(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}) (?P<severity>INFO|WARN|ERROR) (?P<message>[\s\S]*)'
timestamp:
parse_from: attributes.time
layout_type: gotime
layout: '2006-01-02 15:04:05,000'
location: UTC
severity:
parse_from: attributes.severity

processors:
batch:
send_batch_size: 1024
timeout: 5s

exporters:
doris:
endpoint: ${env:VELODB_STREAM_LOAD_ENDPOINT}
database: otel
username: ${env:VELODB_USER}
password: ${env:VELODB_PASSWORD}
table:
logs: otel_logs
create_schema: false
timezone: UTC
timeout: 60s
log_response: true
retry_on_failure:
enabled: true
initial_interval: 5s
max_interval: 30s
headers:
load_to_single_tablet: "true"

service:
pipelines:
logs:
receivers: [filelog]
processors: [batch]
exporters: [doris]

Start the Collector from the directory that contains the configuration file:

./otelcol-contrib --config opentelemetry_java_log.yml

The filelog receiver uses start_at: beginning for this trial. Review file checkpoints and persistent receiver storage before production deployment or restarting collectors that must not re-read files.

Example 2: Collect JSON logs​

Parse newline-delimited JSON events

Use this example for a file with one JSON event per line and an RFC 3339 UTC created_at field, such as events from GH Archive. The json_parser extracts fields as log attributes and sets the event timestamp from created_at.

If you download a compressed archive, decompress it before collection. Use a recent archive, or prepare historical partitions for older files before ingestion. A fixed 2024 sample falls outside a rolling 30-day retention window.

Save the following as opentelemetry_json_log.yml and replace the file path:

receivers:
filelog:
include:
- /path/to/events.json
start_at: beginning
operators:
- type: json_parser
timestamp:
parse_from: attributes.created_at
layout_type: gotime
layout: '2006-01-02T15:04:05Z'

processors:
batch:
send_batch_size: 1024
timeout: 5s

exporters:
doris:
endpoint: ${env:VELODB_STREAM_LOAD_ENDPOINT}
database: otel
username: ${env:VELODB_USER}
password: ${env:VELODB_PASSWORD}
table:
logs: otel_logs
create_schema: false
timezone: UTC
timeout: 60s
log_response: true
retry_on_failure:
enabled: true
initial_interval: 5s
max_interval: 30s
headers:
load_to_single_tablet: "true"

service:
pipelines:
logs:
receivers: [filelog]
processors: [batch]
exporters: [doris]

Start the Collector:

./otelcol-contrib --config opentelemetry_json_log.yml

This pipeline writes OpenTelemetry log records to otel.otel_logs. It does not create a github_events table with actor or repo columns. Query parsed fields through log_attributes, or define a separate transformation and schema for a different data model.

Example 3: Collect application traces​

Receive OTLP and export spans to a warehouse table

Create the trace schema and use the complete Collector configuration in Trace storage and analysis. That guide uses log_db.trace_table, configures service.pipelines.traces, and disables automatic schema creation.

For an application and Collector on the same host, the guide uses OTLP HTTP/protobuf at http://127.0.0.1:4318. Set both the protocol and endpoint explicitly. For OTLP gRPC, use the configured gRPC receiver, commonly port 4317, and set the client protocol to grpc.

If applications run on other hosts, configure an accessible receiver address and protect it with TLS, authentication, and network access controls. A warehouse endpoint is the export destination, rather than the application's OTLP receiver address.

Verify ingestion​

Check the Collector's startup and export logs. Inspect Stream Load responses for Status, NumberLoadedRows, NumberFilteredRows, and Message. A successful HTTP response alone does not establish a successful load.

Then query recent records:

SELECT timestamp, severity_text, body, log_attributes
FROM otel.otel_logs
ORDER BY timestamp DESC
LIMIT 20;

Compare a known event's timestamp, severity, body, and parsed attributes with its source file. Check multiline events before increasing traffic.

Common errors​

SymptomProbable causeResolution
Unknown exporter dorisThe binary does not include the exporter.Use the documented Contrib distribution and verify its components.
The Collector rejects the configurationAn option is unsupported in the installed version or the YAML is invalid.Check options against that version's exporter and receiver references.
The file receiver emits no logsIncorrect path, unreadable file, or unmatched format.Check permissions on the Collector host and test the parser with a small recent file.
Export requests failEndpoint, TLS, network, or authentication mismatch.Use the warehouse-generated Stream Load endpoint and connection requirements.
Rows are filteredTimestamp, schema, or partition mismatch.Inspect the load response and ErrorURL when present. Check SHOW PARTITIONS FROM otel.otel_logs.
Old sample files cannot loadEvent timestamps fall outside the retention window.Use current events or create suitable historical partitions before loading.
Queues grow continuouslyExport cannot keep up with collection.Check errors and load capacity before changing queue size, batching, or concurrency.

Cost and cleanup​

Continuous collection consumes warehouse compute and storage. The Collector host and network traffic can incur separate infrastructure charges. Review Billing and set retention before increasing traffic.

After a trial, stop the Collector. If otel.otel_logs contains only disposable test data, remove it:

DROP TABLE otel.otel_logs;

Remove unused collector resources. Preserve receiver checkpoints if you plan to resume collection without replaying input files.

See also​

Enter to send · Shift+Enter for a new line