Package codes.grow.packages.betterstack
package codes.grow.packages.betterstack
Grow Codes SDK for Better Stack Logs.
Start with BetterStackClient.fromEnv(). The client
talks to two hosts with separate credentials: the source's ingesting host (BetterStackClient.logClient(), BetterStackLogExporter, BetterStackOtlpLogExporter) and the SQL query API (BetterStackQuery: query, searchLogs,
waitForLog, tail).
Shared building blocks live in core (errors, transport, redaction); the logging
category API in logging; in-memory fakes and the conformance runner in testing.
Not affiliated with Better Stack, Inc.
-
ClassDescriptionClient for Better Stack Logs: ingestion through the source's ingesting host (
BetterStackClient.logClient(),BetterStackClient.exporter(),BetterStackClient.otlpExporter()) and the SQL query API (BetterStackClient.query()), each with its own credentials and transport.Builder that configures and creates a client in one chain.Immutable configuration of aBetterStackClient(SPEC section 2.2).Builder of the configuration.Better Stack specific error mapping on top of the SPEC section 2.1 HTTP mapping.MapsLogRecords to Better Stack events and encodes request bodies (JSON, NDJSON, MessagePack).Options ofBetterStackClient.logClient(BetterStackLogClientOptions): protocol, exporter options, batching, resource and redaction.Builder ofBetterStackLogClientOptions.LogExporterfor Better Stack's HTTP ingest API (POST {url}/on the source's ingesting host,Authorization: Bearer <source token>).Options of aBetterStackLogExporter: body encoding and request limits.LogExporterthat sends OTLP/HTTP logs to the source's ingesting host (POST {url}/v1/logs,Authorization: Bearer <source token>), protobuf by default or OTLP/JSON.Options of aBetterStackOtlpLogExporter.SQL query client for Better Stack Logs: the ClickHouse HTTP interface of the query host with the connection's own Basic credentials.Body encodings accepted byPOST /on a Better Stack source's ingesting host.Wire protocol of aBetterStackClient.logClient(BetterStackLogClientOptions).Minimal MessagePack encoder for Better Stack ingest bodies (no dependency).OTLP logs encoding without dependencies:ExportLogsServiceRequestas protobuf (field numbers of opentelemetry-protocollector/logs/v1andlogs/v1) or as OTLP/JSON, andpartial_successparsing of the response.Partial success reported by an OTLP response.Payload format ofBetterStackOtlpLogExporter.Better Stack answered402 Quota exceeded: the team's quota or spending limit is reached.Options ofBetterStackQuery.searchLogs(SearchLogsOptions).Builder ofSearchLogsOptions.The service answered with a body the SDK cannot use: an invalid JSON response or a ClickHouse exception without a specific mapping that followed a200answer.