Skip to content

Commit 896083e

Browse files
Feature/add mis endpoints in monitoring (#701)
1 parent 152c3f4 commit 896083e

File tree

5 files changed

+547
-1
lines changed

5 files changed

+547
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ DOCKER_CMD:=docker run
1616
GOBUILDTAGS:=$(TAGS)
1717
GOBUILDTAGSOPT=-tags "$(GOBUILDTAGS)"
1818

19-
ARANGODB ?= arangodb/arangodb:latest
19+
ARANGODB ?= arangodb/enterprise:latest
2020
STARTER ?= arangodb/arangodb-starter:latest
2121

2222
ifndef TESTOPTIONS

v2/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [master](https://github.com/arangodb/go-driver/tree/master) (N/A)
44
- Add missing endpoints from replication to v2
5+
- Add missing endpoints from monitoring to v2
56

67
## [2.1.5](https://github.com/arangodb/go-driver/tree/v2.1.5) (2025-08-31)
78
- Add tasks endpoints to v2

v2/arangodb/client_admin.go

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ type ClientAdminLog interface {
5151

5252
// SetLogLevels sets log levels for a given topics.
5353
SetLogLevels(ctx context.Context, logLevels LogLevels, opts *LogLevelsSetOptions) error
54+
55+
// Logs retrieve logs from server in ArangoDB 3.8.0+ format
56+
Logs(ctx context.Context, queryParams *AdminLogEntriesOptions) (AdminLogEntriesResponse, error)
57+
58+
// DeleteLogLevels removes log levels for a specific server.
59+
DeleteLogLevels(ctx context.Context, serverId *string) (LogLevelResponse, error)
60+
61+
// GetStructuredLogSettings returns the server's current structured log settings.
62+
GetStructuredLogSettings(ctx context.Context) (LogSettingsOptions, error)
63+
64+
// UpdateStructuredLogSettings modifies and returns the server's current structured log settings.
65+
UpdateStructuredLogSettings(ctx context.Context, opts *LogSettingsOptions) (LogSettingsOptions, error)
66+
67+
// GetRecentAPICalls gets a list of the most recent requests with a timestamp and the endpoint
68+
GetRecentAPICalls(ctx context.Context, dbName string) (ApiCallsResponse, error)
69+
70+
// GetMetrics returns the instance's current metrics in Prometheus format
71+
GetMetrics(ctx context.Context, dbName string, serverId *string) ([]byte, error)
5472
}
5573

5674
type ClientAdminLicense interface {
@@ -61,3 +79,201 @@ type ClientAdminLicense interface {
6179
// Can be called on single servers, Coordinators, and DB-Servers.
6280
SetLicense(ctx context.Context, license string, force bool) error
6381
}
82+
83+
type AdminLogEntriesOptions struct {
84+
// Upto log level
85+
Upto string `json:"upto"` // (default: "info")
86+
87+
// Returns all log entries of log level level.
88+
// Note that the query parameters upto and level are mutually exclusive.
89+
Level *string `json:"level,omitempty"`
90+
91+
// Start position
92+
Start int `json:"start"` // (default: 0)
93+
94+
// Restricts the result to at most size log entries.
95+
Size *int `json:"size,omitempty"`
96+
97+
// Offset position
98+
Offset int `json:"offset"` // (default: 0)
99+
100+
// Only return the log entries containing the text specified in search.
101+
Search *string `json:"search,omitempty"`
102+
103+
// Sort the log entries either ascending (if sort is asc) or
104+
// descending (if sort is desc) according to their id values.
105+
Sort string `json:"sort,omitempty"` // (default: "asc")
106+
107+
// Returns all log entries of the specified server.
108+
// If no serverId is given, the asked server will reply.
109+
// This parameter is only meaningful on Coordinators.
110+
ServerId *string `json:"serverId,omitempty"`
111+
}
112+
113+
type AdminLogEntriesResponse struct {
114+
// Total number of log entries
115+
Total int `json:"total"`
116+
117+
// List of log messages
118+
Messages []MessageObject `json:"messages"`
119+
}
120+
121+
type MessageObject struct {
122+
Id int `json:"id"`
123+
// Log topic
124+
Topic string `json:"topic"`
125+
// Log level
126+
Level string `json:"level"`
127+
// Current date and time
128+
Date string `json:"date"`
129+
// Log message
130+
Message string `json:"message"`
131+
}
132+
133+
type LogLevelResponse struct {
134+
Agency string `json:"agency"`
135+
// Communication between Agency instances.
136+
AgencyComm string `json:"agencycomm"`
137+
// Agency's Raft store operations.
138+
AgencyStore string `json:"agencystore"`
139+
// Backup and restore processes.
140+
Backup string `json:"backup"`
141+
// Benchmarking and performance test logs.
142+
Bench string `json:"bench"`
143+
// General cluster-level logs.
144+
Cluster string `json:"cluster"`
145+
// Network communication between servers.
146+
Communication string `json:"communication"`
147+
// User authentication activities.
148+
Authentication string `json:"authentication"`
149+
// Configuration-related logs.
150+
Config string `json:"config"`
151+
// Crash handling.
152+
Crash string `json:"crash"`
153+
// Data export (dump) operations.
154+
Dump string `json:"dump"`
155+
// Storage engines (RocksDB)
156+
Engines string `json:"engines"`
157+
// General server logs not tied to a specific topic.
158+
General string `json:"general"`
159+
// Cluster heartbeat monitoring.
160+
Heartbeat string `json:"heartbeat"`
161+
// AQL query execution and planning.
162+
Aql string `json:"aql"`
163+
// Graph operations and traversals.
164+
Graphs string `json:"graphs"`
165+
// Maintenance operations in cluster.
166+
Maintenance string `json:"maintenance"`
167+
// User authorization and permissions.
168+
Authorization string `json:"authorization"`
169+
// Query execution and lifecycle.
170+
Queries string `json:"queries"`
171+
// Development/debugging logs.
172+
Development string `json:"development"`
173+
// Replication processes (followers, leaders).
174+
Replication string `json:"replication"`
175+
// V8 JavaScript engine logs.
176+
V8 string `json:"v8"`
177+
// Usage of deprecated features.
178+
Deprecation string `json:"deprecation"`
179+
// RocksDB storage engine-specific logs
180+
RocksDB string `json:"rocksdb"`
181+
// Audit logs for database operations.
182+
AuditDatabase string `json:"audit-database"`
183+
// Data validation errors/warnings.
184+
Validation string `json:"validation"`
185+
// RocksDB flush operations.
186+
Flush string `json:"flush"`
187+
// Audit logs for authorization events.
188+
AuditAuthorization string `json:"audit-authorization"`
189+
// System calls made by the server.
190+
Syscall string `json:"syscall"`
191+
// In-memory cache usage and performance.
192+
Cache string `json:"cache"`
193+
// Security-related logs.
194+
Security string `json:"security"`
195+
// Memory allocation and usage.
196+
Memory string `json:"memory"`
197+
// Restore operations from backup.
198+
Restore string `json:"restore"`
199+
// HTTP client communication logs.
200+
HTTPClient string `json:"httpclient"`
201+
// Audit logs for view operations.
202+
AuditView string `json:"audit-view"`
203+
// Audit logs for document operations.
204+
AuditDocument string `json:"audit-document"`
205+
// Audit logs for hot backup.
206+
AuditHotBackup string `json:"audit-hotbackup"`
207+
// Audit logs for collection operations.
208+
AuditCollection string `json:"audit-collection"`
209+
// Server statistics collection.
210+
Statistics string `json:"statistics"`
211+
// Incoming client requests.
212+
Requests string `json:"requests"`
213+
// Audit logs for service-level actions.
214+
AuditService string `json:"audit-service"`
215+
// TTL (Time-to-Live) expiration logs.
216+
TTL string `json:"ttl"`
217+
// Next-gen replication subsystem logs.
218+
Replication2 string `json:"replication2"`
219+
// SSL/TLS communication logs.
220+
SSL string `json:"ssl"`
221+
// Thread management logs.
222+
Threads string `json:"threads"`
223+
// License-related logs.
224+
License string `json:"license"`
225+
// IResearch (ArangoSearch) library logs.
226+
Libiresearch string `json:"libiresearch"`
227+
// Transactions.
228+
Trx string `json:"trx"`
229+
// Supervision process in the cluster.
230+
Supervision string `json:"supervision"`
231+
// Server startup sequence.
232+
Startup string `json:"startup"`
233+
// Audit logs for authentication events.
234+
AuditAuthentication string `json:"audit-authentication"`
235+
// Replication Write-Ahead Log.
236+
RepWal string `json:"rep-wal"`
237+
// View-related logs.
238+
Views string `json:"views"`
239+
// ArangoSearch engine logs.
240+
ArangoSearch string `json:"arangosearch"`
241+
// Replication state machine logs.
242+
RepState string `json:"rep-state"`
243+
}
244+
245+
// LogSettingsOptions represents configurable flags for including
246+
// specific fields in structured log output. It is used both in
247+
// requests (to configure log behavior) and responses (to indicate
248+
// which fields are currently enabled).
249+
type LogSettingsOptions struct {
250+
// Database indicates whether the database name should be included
251+
// in structured log entries.
252+
Database *bool `json:"database,omitempty"`
253+
254+
// Url indicates whether the request URL should be included
255+
// in structured log entries.
256+
Url *bool `json:"url,omitempty"`
257+
258+
// Username indicates whether the authenticated username should be included
259+
// in structured log entries.
260+
Username *bool `json:"username,omitempty"`
261+
}
262+
263+
type ApiCallsObject struct {
264+
// TimeStamp is the UTC timestamp when the API call was executed.
265+
TimeStamp string `json:"timeStamp"`
266+
267+
// RequestType is the HTTP method used for the call (e.g., GET, POST).
268+
RequestType string `json:"requestType"`
269+
270+
// Path is the HTTP request path that was accessed.
271+
Path string `json:"path"`
272+
273+
// Database is the name of the database the API call was executed against.
274+
Database string `json:"database"`
275+
}
276+
277+
type ApiCallsResponse struct {
278+
Calls []ApiCallsObject `json:"calls"`
279+
}

0 commit comments

Comments
 (0)