requestlogep

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListRequestLogsEndpoint

type ListRequestLogsEndpoint struct{}

Returns a paginated list of API request logs, newest first.

Results cover every request where your account is either the acting account or the account that was acted upon, so requests a customer or supplier made against your data appear alongside your own. The `q` parameter matches a log ID exactly and otherwise searches the request path, the normalized route, and the error message.

Requests to a number of high-traffic endpoints — including these logging endpoints themselves — are recorded but withheld from this listing so they do not drown out the rest of your traffic. They can still be fetched individually by ID.

type ListRequestLogsRequest

type ListRequestLogsRequest struct {
	apiresource.PaginationRequest
	// Restricts results to request logs on or after this timestamp.
	StartDate *time.Time `query:"starts_at"`
	// Restricts results to request logs on or before this timestamp.
	EndDate *time.Time `query:"ends_at"`
	// Filter by the HTTP method.
	Methods []constants.HTTPMethod `query:"methods"`
	// Filter by the HTTP status code.
	StatusCodes []int32 `query:"status_codes"`
	// Filter by the HTTP status class, expressed as the leading digit: `1`–`5` for 1xx–5xx.
	//
	// Combined with `status_codes` using OR — e.g. `status_codes=401` and `status_code_classes=5` matches 401 responses and any 5xx response.
	StatusCodeClasses []int32 `query:"status_code_classes"`
	// Filter by API error code.
	ErrorCodes []apierror.ErrorCode `query:"error_codes"`
	// Exclude request logs whose API error code is in this set.
	//
	// Applied as a negative filter after all other filters. Successful requests (which have no error code) are always kept. The OpenMRP dashboard uses this to hide routine `expired_token` 401s — the noise from short-lived access tokens expiring and clients silently refreshing — while still surfacing genuine auth failures like `invalid_credentials`.
	ExcludeErrorCodes []apierror.ErrorCode `query:"exclude_error_codes"`
	// Filter by the _acting_ account: the account the actor belongs to (the log's `account.id`).
	//
	// Results are always scoped to logs where your account is either the acting account or the target account; this narrows that set to specific acting accounts. For example, pass a customer's account ID to see only requests that customer's actors made against your account.
	ActorAccountIDs []string `query:"actor_account_ids"`
	// Filter by the _target_ account: the account the request acted upon (the log's target account).
	//
	// Results are always scoped to logs where your account is either the acting account or the target account; this narrows that set to specific target accounts. For example, pass a supplier's account ID to see only requests your account made against that supplier.
	TargetAccountIDs []string `query:"target_account_ids"`
	// Filter by the actor identifier.
	//
	// Matches the log's `actor.id`: a user ID for `user` actors, an API key ID for `api_key` actors, or an agent ID for `agent` actors.
	ActorIDs []string `query:"actor_ids"`
	// Filter by the actor type.
	//
	// Requests are recorded for actors of type `user`, `api_key`, and `agent` — the last covering calls an OpenMRP agent made on your account's behalf.
	ActorTypes []constants.ActorType `query:"actor_types"`
	// Filter by the _normalized_ route template.
	//
	// For example `/v1/sales/customers/{id}` matches every request to that route regardless of the specific customer ID. Parameter names inside `{}` are ignored when matching, so `{customer_id}` and `{id}` are equivalent.
	NormalizedRoutes []string `query:"normalized_routes"`
	// Filter by the request host.
	//
	// Typically `api.openmrp.ai`.
	Hosts []string `query:"hosts"`
	// Restricts results to requests that took at least this many microseconds.
	MinLatencyUs *int64 `query:"min_latency_us"`
	// Filter by the user-provided idempotency key.
	IdempotencyKey *string `query:"idempotency_key"`
}

Request to list request logs.

type RequestLogSvc

type RequestLogSvc interface {
	ListRequestLogs(ctx context.Context, req *ListRequestLogsRequest) (*apiresource.List[apiresource.RequestLog], *apierror.APIError)
	GetRequestLog(ctx context.Context, req *RetrieveRequestLogRequest) (*apiresource.RequestLog, *apierror.APIError)
}

func NewRequestLogSvc

func NewRequestLogSvc(config *RequestLogSvcConfig) RequestLogSvc

type RequestLogSvcConfig

type RequestLogSvcConfig struct {
	// LoggingClient (required) is the platform-service logging gRPC client.
	LoggingClient pb.LoggingServiceClient
}

type RetrieveRequestLogEndpoint

type RetrieveRequestLogEndpoint struct{}

Returns a single API request log by ID.

The log is readable when your account is either the acting account or the account that was acted upon. This is also the only endpoint that can return the captured query parameters and request and response bodies, and the only way to read the high-traffic-endpoint logs that are withheld from the list endpoint.

func (*RetrieveRequestLogEndpoint) Materialize

type RetrieveRequestLogRequest

type RetrieveRequestLogRequest struct {
	// Request log ID.
	ID string `path:"id" validate:"required"`
}

Request to retrieve a request log.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL