Skip to main content

Snowflake

Overview​

Snowflake streams logs from a Praxis collector to Snowflake via the Snowpipe Streaming v2 REST API. The exporter targets a pre-created pipe bound to a table in your Snowflake account; each OpenTelemetry log record becomes one row.

Supported types: Logs

Minimum collector version: 0.3.0

Note: Snowpipe Streaming has no first-party Go SDK. The exporter is a hand-rolled REST client. The default path_template targets the v2 row-insert endpoint and is overridable per Snowflake API version.

Authentication​

Authentication supports both OAuth2 and Basic Auth credential types.

Credential typeWhen to use
OAuth2 (oauth2)Use when Snowflake is configured with an OAuth security integration. Configure token_url, client_id, client_secret, and (typically) scope (e.g. session:role:LOGS_INGEST).
Basic Auth (basicauth)Use when your Snowflake endpoint is configured to accept HTTP Basic credentials. Configure username and password in a basicauth credential.

Snowflake security integration​

CREATE SECURITY INTEGRATION praxis_collector_oauth
TYPE = OAUTH
ENABLED = TRUE
OAUTH_CLIENT = CUSTOM
OAUTH_CLIENT_TYPE = 'CONFIDENTIAL'
OAUTH_REDIRECT_URI = 'https://localhost'
OAUTH_ISSUE_REFRESH_TOKENS = TRUE
OAUTH_REFRESH_TOKEN_VALIDITY = 7776000;

SELECT SYSTEM$SHOW_OAUTH_CLIENT_SECRETS('PRAXIS_COLLECTOR_OAUTH');

Use the printed OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET in the OAuth2 credential.

Basic configuration​

ParameterTypeDefaultRequiredDescription
endpointstringnoneYesSnowflake account URL, e.g. https://xy12345.us-east-1.snowflakecomputing.com.
databasestringnoneYesTarget Snowflake database holding the Snowpipe Streaming pipe.
schemastringnoneYesTarget Snowflake schema holding the Snowpipe Streaming pipe.
pipestringnoneYesSnowpipe Streaming pipe object name. The pipe must be pre-created and bound to the target table — the exporter does not issue DDL.
rolestringnoneNoOptional Snowflake role to assume on the streaming session. Sent as X-Snowflake-Role.

Pipe and table setup​

CREATE TABLE TELEMETRY_DB.PUBLIC.LOGS (
TIMESTAMP TIMESTAMP_NTZ,
OBSERVED_TIMESTAMP TIMESTAMP_NTZ,
SEVERITY STRING,
BODY VARIANT,
ATTRIBUTES VARIANT,
RESOURCE_ATTRIBUTES VARIANT,
SCOPE_NAME STRING,
TRACE_ID STRING,
SPAN_ID STRING
);

CREATE PIPE TELEMETRY_DB.PUBLIC.LOGS_PIPE AS
COPY INTO TELEMETRY_DB.PUBLIC.LOGS
FROM TABLE(STREAMING_INSERT(
'TELEMETRY_DB.PUBLIC.LOGS',
'JSON'
));

The exporter emits one JSON row per log record with these keys (snake_case, matching the recommended column names above):

JSON keySource
timestampLogRecord.Timestamp (RFC3339Nano UTC)
observed_timestampLogRecord.ObservedTimestamp (RFC3339Nano UTC)
severityLogRecord.SeverityText or SeverityNumber.String()
bodyLogRecord.Body
attributesLogRecord.Attributes
resource_attributesResource.Attributes
scope_nameInstrumentationScope.Name
trace_id / span_idhex, omitted when zero

Advanced configuration​

ParameterTypeDefaultDescription
path_templatestring/v2/streaming/databases/{database}/schemas/{schema}/pipes/{pipe}/rows:insertURL path appended to endpoint. Substitutes {database}, {schema}, {pipe}. Override when targeting a different Snowpipe Streaming API version.
compressionstringgzipRequest body compression: gzip or none.
max_batch_rowsint10000Cap on rows per REST POST. Larger batches are split.
max_batch_bytesint16777216Cap on serialized request body in bytes (16 MiB).
timeoutint30Per-request HTTP timeout in seconds.
retry_on_failurebooltrueEnable automatic retries on send failures.
backpressure_queuebooltrueEnable a sending queue (with optional disk backing).

TLS (advanced.tls)​

ParameterTypeDefaultDescription
insecure_skip_verifyboolfalseSkip TLS server certificate verification (not recommended in production).
ca_filestringnoneCustom CA bundle for verifying the Snowflake endpoint.

Retry settings​

When retry_on_failure is enabled, retry_on_failure_settings (under advanced) can include:

ParameterTypeDefaultDescription
initial_intervalint5Initial backoff in seconds after a failure.
max_intervalint30Maximum backoff in seconds between attempts.
max_time_elapsedint300Maximum time in seconds spent retrying a batch.

Backpressure queue settings​

When backpressure_queue is enabled, backpressure_queue_settings (under advanced) can include:

ParameterTypeDefaultDescription
queue_sizeint1000Maximum number of batches buffered.
number_of_consumersint4Worker count draining the queue.
enable_disk_backed_queuebooltruePersist the queue to disk via file_storage, surviving restarts. Default flipped to true in v0.3 so collector restarts no longer drop buffered batches.

Metrics​

MetricDescription
otelcol_exporter_request_latencyRound-trip latency histogram.
otelcol_exporter_request_countOutcomes per request (result=success/auth/throttle/server_error/non_retryable/transport_error).
otelcol_exporter_payload_sizeBytes per request.
otelcol_exporter_batch_sizeRows per batch.
exporter_snowflake_api_errorsSnowpipe API errors bucketed by api_code (auth, throttle, other, none).
exporter_snowflake_auth_failuresAuth failures, labeled by auth_kind, status_code.
exporter_snowflake_rows_insertedRows accepted by Snowpipe.
exporter_snowflake_rows_rejectedRows rejected by Snowpipe, by api_code.
collector_destination_records_dropped_totalShared dropped-record counter.
collector_destination_retries_totalShared retry counter.

Limitations​

  • Logs only in the alpha release.
  • No Snowpipe Streaming SDK. Hand-rolled REST. Schema/payload changes between Snowflake API versions are absorbed via path_template; payload-shape changes need a collector update.
  • One pipe per destination. Routing to multiple pipes/tables requires multiple destination nodes.
  • At-least-once. Snowpipe Streaming may accept duplicates on retry.