Documentation ¶
Index ¶
- Constants
- Variables
- func DecodePage[T pageType](rawCursor string) (*T, error)
- func EncodePage[T pageType](p *T) (string, error)
- func GenerateOTELExponentialHistogramMetrics(attributes map[string]string) pmetric.Metrics
- func GenerateOTELGaugeMetrics(attributes map[string]string, value float64) pmetric.Metrics
- func GenerateOTELHistogramMetrics(attributes map[string]string, startTimestamp time.Time, timestamp time.Time, ...) pmetric.Metrics
- func GenerateOTELMetrics(mtype pmetric.MetricType, attributes map[string]string, value float64) pmetric.Metrics
- func GenerateOTELSumMetrics(attributes map[string]string, startTimestamp time.Time, timestamp time.Time, ...) pmetric.Metrics
- func GetProjectIDFromRequest(ctx *gin.Context) (string, error)
- func PersistOTELMetrics(ctx context.Context, db clickhouse.Conn, logger *zap.Logger, ...) error
- func SetupTestServer(ctx context.Context) (*testutils.ClickHouseServer, driver.Conn, error)
- type LogsPage
Constants ¶
const ( RandomProjectID string = "12345" RandomNamespaceID string = "123" RandomServiceName string = "test-service" RandomMetricName string = "random-metric-name" )
const LogBodyMaxPrefixSize = 128
Variables ¶
var ( RandomTraceID = [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4} RandomSpanID = [8]byte{0, 0, 0, 0, 1, 2, 3, 4} )
var ErrUnknownProjectID = errors.New("unknown project ID")
Functions ¶
func DecodePage ¶
func EncodePage ¶
func GenerateOTELMetrics ¶
func GenerateOTELSumMetrics ¶
func GetProjectIDFromRequest ¶
GetProjectIDFromRequest retrieves the project ID from the request context.
It prioritizes the header value over the path parameter to satisfy both v3 and v4 versions of the query API. Returns the project ID as a string.
func PersistOTELMetrics ¶
func SetupTestServer ¶
Types ¶
type LogsPage ¶
type LogsPage struct { LastSeenTimestamp string `json:"last_seen_timestamp,omitempty"` LastSeenTraceID string `json:"trace_id" ch:"TraceId"` LastSeenSpanID string `json:"span_id" ch:"SpanId"` LastSeenServiceName string `json:"service_name"` // We can't really put the whole body into the URL, but OTOH some logs may // different by only the logs body. A compro LastSeenBodyPrefix string `json:"body"` }
LogsPage holds the details of the page token needed for the next page.
Requests for the next page should include this cursor in the page token parameter. Even though we use nanosecond precision internally, we still need to account for other fields when accurately determining last entry on the given page, as some tooling may simply round the timestamp to the closests second (or simply have 1-second precision in the first place), resulting in multiple log entries having the same timestamp.
These fields do not 100% guarantee that we will not display a log entry twice (i.e. on previous page and then on the next), but should greatly reduce the risk.
Fields below belong to the index CH is using.