Skip to content

Commit 08ba989

Browse files
Feature/add mis endpoints in administration (#702)
1 parent 896083e commit 08ba989

File tree

4 files changed

+677
-0
lines changed

4 files changed

+677
-0
lines changed

v2/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [master](https://github.com/arangodb/go-driver/tree/master) (N/A)
44
- Add missing endpoints from replication to v2
55
- Add missing endpoints from monitoring to v2
6+
- Add missing endpoints from administration to v2
67

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

v2/arangodb/client_admin.go

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,34 @@ type ClientAdmin interface {
4343
// Use ClientAdminCluster.Health() to fetch the Endpoint list.
4444
// For ActiveFailover, it will return an error (503 code) if the server is not the leader.
4545
CheckAvailability(ctx context.Context, serverEndpoint string) error
46+
47+
// GetSystemTime returns the current system time as a Unix timestamp with microsecond precision.
48+
GetSystemTime(ctx context.Context, dbName string) (float64, error)
49+
50+
// GetServerStatus returns status information about the server.
51+
GetServerStatus(ctx context.Context, dbName string) (ServerStatusResponse, error)
52+
53+
// GetDeploymentSupportInfo retrieves deployment information for support purposes.
54+
GetDeploymentSupportInfo(ctx context.Context) (SupportInfoResponse, error)
55+
56+
// GetStartupConfiguration return the effective configuration of the queried arangod instance.
57+
GetStartupConfiguration(ctx context.Context) (map[string]interface{}, error)
58+
59+
// GetStartupConfigurationDescription fetches the available startup configuration
60+
// options of the queried arangod instance.
61+
GetStartupConfigurationDescription(ctx context.Context) (map[string]interface{}, error)
62+
63+
// ReloadRoutingTable reloads the routing information from the _routing system collection.
64+
ReloadRoutingTable(ctx context.Context, dbName string) error
65+
66+
// ExecuteAdminScript executes JavaScript code on the server.
67+
// Note: Requires ArangoDB to be started with --javascript.allow-admin-execute enabled.
68+
ExecuteAdminScript(ctx context.Context, dbName string, script *string) (interface{}, error)
69+
70+
// CompactDatabases can be used to reclaim disk space after substantial data deletions have taken place,
71+
// by compacting the entire database system data.
72+
// The endpoint requires superuser access.
73+
CompactDatabases(ctx context.Context, opts *CompactOpts) (map[string]interface{}, error)
4674
}
4775

4876
type ClientAdminLog interface {
@@ -277,3 +305,239 @@ type ApiCallsObject struct {
277305
type ApiCallsResponse struct {
278306
Calls []ApiCallsObject `json:"calls"`
279307
}
308+
309+
type ServerStatusResponse struct {
310+
// The server type (e.g., "arango")
311+
Server *string `json:"server,omitempty"`
312+
// The server version string (e.g,. "3.12.*")
313+
Version *string `json:"version,omitempty"`
314+
// Process ID of the server
315+
Pid *int `json:"pid,omitempty"`
316+
// License type (e.g., "community" or "enterprise")
317+
License *string `json:"license,omitempty"`
318+
// Mode in which the server is running
319+
Mode *string `json:"mode,omitempty"`
320+
// Operational mode (e.g., "server", "coordinator")
321+
OperationMode *string `json:"operationMode,omitempty"`
322+
// Whether the Foxx API is enabled
323+
FoxxApi *bool `json:"foxxApi,omitempty"`
324+
// Host of the server
325+
Host *string `json:"host,omitempty"`
326+
// System hostname of the server
327+
Hostname *string `json:"hostname,omitempty"`
328+
// Nested server information details
329+
ServerInfo ServerInformation `json:"serverInfo"`
330+
331+
// Present only in cluster mode
332+
Coordinator *CoordinatorInfo `json:"coordinator,omitempty"`
333+
Agency *AgencyInfo `json:"agency,omitempty"`
334+
}
335+
336+
// ServerInformation provides detailed information about the server’s state.
337+
// Some fields are present only in cluster deployments.
338+
type ServerInformation struct {
339+
// Current progress of the server
340+
Progress ServerProgress `json:"progress"`
341+
// Whether the server is in maintenance mode
342+
Maintenance *bool `json:"maintenance,omitempty"`
343+
// Role of the server (e.g., "SINGLE", "COORDINATOR")
344+
Role *string `json:"role,omitempty"`
345+
// Whether write operations are enabled
346+
WriteOpsEnabled *bool `json:"writeOpsEnabled,omitempty"`
347+
// Whether the server is in read-only mode
348+
ReadOnly *bool `json:"readOnly,omitempty"`
349+
350+
// Persisted server identifier (cluster only)
351+
PersistedId *string `json:"persistedId,omitempty"`
352+
// Reboot ID
353+
RebootId *int `json:"rebootId,omitempty"`
354+
// Network address
355+
Address *string `json:"address,omitempty"`
356+
// Unique server identifier
357+
ServerId *string `json:"serverId,omitempty"`
358+
// Current server state
359+
State *string `json:"state,omitempty"`
360+
}
361+
362+
// ServerProgress contains information about the startup or recovery phase.
363+
type ServerProgress struct {
364+
// Current phase of the server (e.g., "in wait")
365+
Phase *string `json:"phase,omitempty"`
366+
// Current feature being processed (if any)
367+
Feature *string `json:"feature,omitempty"`
368+
// Recovery tick value
369+
RecoveryTick *int `json:"recoveryTick,omitempty"`
370+
}
371+
372+
// CoordinatorInfo provides information specific to the coordinator role (cluster only).
373+
type CoordinatorInfo struct {
374+
// ID of the Foxxmaster coordinator
375+
Foxxmaster *string `json:"foxxmaster,omitempty"`
376+
// Whether this server is the Foxxmaster
377+
IsFoxxmaster *bool `json:"isFoxxmaster,omitempty"`
378+
}
379+
380+
// AgencyInfo contains information about the agency configuration (cluster only).
381+
type AgencyInfo struct {
382+
// Agency communication details
383+
AgencyComm *AgencyCommInfo `json:"agencyComm,omitempty"`
384+
}
385+
386+
// AgencyCommInfo contains communication endpoints for the agency.
387+
type AgencyCommInfo struct {
388+
// List of agency endpoints
389+
Endpoints *[]string `json:"endpoints,omitempty"`
390+
}
391+
392+
// ServerInfo contains details about either a single server host
393+
// (in single-server deployments) or individual servers (in cluster deployments).
394+
type ServerInfo struct {
395+
// Role of the server (e.g., SINGLE, COORDINATOR, DBServer, etc.)
396+
Role *string `json:"role,omitempty"`
397+
398+
// Whether the server is in maintenance mode
399+
Maintenance *bool `json:"maintenance,omitempty"`
400+
401+
// Whether the server is in read-only mode
402+
ReadOnly *bool `json:"readOnly,omitempty"`
403+
404+
// ArangoDB version running on the server
405+
Version *string `json:"version,omitempty"`
406+
407+
// Build identifier of the ArangoDB binary
408+
Build *string `json:"build,omitempty"`
409+
410+
// License type (e.g., community, enterprise)
411+
License *string `json:"license,omitempty"`
412+
413+
// Operating system information string
414+
Os *string `json:"os,omitempty"`
415+
416+
// Platform (e.g., linux, windows, macos)
417+
Platform *string `json:"platform,omitempty"`
418+
419+
// Information about the physical memory of the host
420+
PhysicalMemory PhysicalMemoryInfo `json:"physicalMemory"`
421+
422+
// Information about the number of CPU cores
423+
NumberOfCores PhysicalMemoryInfo `json:"numberOfCores"`
424+
425+
// Process statistics (uptime, memory, threads, etc.)
426+
ProcessStats ProcessStatsInfo `json:"processStats"`
427+
428+
// CPU utilization statistics
429+
CpuStats CpuStatsInfo `json:"cpuStats"`
430+
431+
// Optional storage engine statistics (only present in some responses)
432+
EngineStats *EngineStatsInfo `json:"engineStats,omitempty"`
433+
}
434+
435+
// PhysicalMemoryInfo represents a numeric system property and whether it was overridden.
436+
type PhysicalMemoryInfo struct {
437+
// The value of the property (e.g., memory size, CPU cores)
438+
Value *int64 `json:"value,omitempty"`
439+
440+
// Whether this value was overridden by configuration
441+
Overridden *bool `json:"overridden,omitempty"`
442+
}
443+
444+
// ProcessStatsInfo contains runtime statistics of the ArangoDB process.
445+
type ProcessStatsInfo struct {
446+
// Uptime of the process in seconds
447+
ProcessUptime *float64 `json:"processUptime,omitempty"`
448+
449+
// Number of active threads
450+
NumberOfThreads *int `json:"numberOfThreads,omitempty"`
451+
452+
// Virtual memory size in bytes
453+
VirtualSize *int64 `json:"virtualSize,omitempty"`
454+
455+
// Resident set size (RAM in use) in bytes
456+
ResidentSetSize *int64 `json:"residentSetSize,omitempty"`
457+
458+
// Number of open file descriptors
459+
FileDescriptors *int `json:"fileDescriptors,omitempty"`
460+
461+
// Limit on the number of file descriptors
462+
FileDescriptorsLimit *int64 `json:"fileDescriptorsLimit,omitempty"`
463+
}
464+
465+
// CpuStatsInfo contains CPU usage percentages.
466+
type CpuStatsInfo struct {
467+
// Percentage of CPU time spent in user mode
468+
UserPercent *float64 `json:"userPercent,omitempty"`
469+
470+
// Percentage of CPU time spent in system/kernel mode
471+
SystemPercent *float64 `json:"systemPercent,omitempty"`
472+
473+
// Percentage of CPU time spent idle
474+
IdlePercent *float64 `json:"idlePercent,omitempty"`
475+
476+
// Percentage of CPU time spent waiting for I/O
477+
IowaitPercent *float64 `json:"iowaitPercent,omitempty"`
478+
}
479+
480+
// EngineStatsInfo contains metrics from the RocksDB storage engine and cache.
481+
type EngineStatsInfo struct {
482+
CacheLimit *int64 `json:"cache.limit,omitempty"`
483+
CacheAllocated *int64 `json:"cache.allocated,omitempty"`
484+
RocksdbEstimateNumKeys *int `json:"rocksdb.estimate-num-keys,omitempty"`
485+
RocksdbEstimateLiveDataSize *int `json:"rocksdb.estimate-live-data-size,omitempty"`
486+
RocksdbLiveSstFilesSize *int `json:"rocksdb.live-sst-files-size,omitempty"`
487+
RocksdbBlockCacheCapacity *int64 `json:"rocksdb.block-cache-capacity,omitempty"`
488+
RocksdbBlockCacheUsage *int `json:"rocksdb.block-cache-usage,omitempty"`
489+
RocksdbFreeDiskSpace *int64 `json:"rocksdb.free-disk-space,omitempty"`
490+
RocksdbTotalDiskSpace *int64 `json:"rocksdb.total-disk-space,omitempty"`
491+
}
492+
493+
// DeploymentInfo contains information about the deployment type and cluster layout.
494+
type DeploymentInfo struct {
495+
// Type of deployment ("single" or "cluster")
496+
Type *string `json:"type,omitempty"`
497+
498+
// Map of servers in the cluster, keyed by server ID (only present in cluster mode)
499+
Servers *map[ServerID]ServerInfo `json:"servers,omitempty"`
500+
501+
// Number of agents in the cluster (cluster only)
502+
Agents *int `json:"agents,omitempty"`
503+
504+
// Number of coordinators in the cluster (cluster only)
505+
Coordinators *int `json:"coordinators,omitempty"`
506+
507+
// Number of DB servers in the cluster (cluster only)
508+
DbServers *int `json:"dbServers,omitempty"`
509+
510+
// Shard distribution details (cluster only)
511+
Shards *ShardsInfo `json:"shards,omitempty"`
512+
}
513+
514+
// ShardsInfo contains information about shard distribution in a cluster deployment.
515+
type ShardsInfo struct {
516+
Databases *int `json:"databases,omitempty"`
517+
Collections *int `json:"collections,omitempty"`
518+
Shards *int `json:"shards,omitempty"`
519+
Leaders *int `json:"leaders,omitempty"`
520+
RealLeaders *int `json:"realLeaders,omitempty"`
521+
Followers *int `json:"followers,omitempty"`
522+
Servers *int `json:"servers,omitempty"`
523+
}
524+
525+
// SupportInfoResponse is the top-level response for GET /_db/_system/_admin/support-info.
526+
// It provides details about the current deployment and server environment.
527+
type SupportInfoResponse struct {
528+
// Deployment information (single or cluster, with related details)
529+
Deployment DeploymentInfo `json:"deployment"`
530+
531+
// Host/server details (only present in single-server mode)
532+
Host *ServerInfo `json:"host,omitempty"`
533+
534+
// Timestamp when the data was collected
535+
Date *string `json:"date,omitempty"`
536+
}
537+
538+
type CompactOpts struct {
539+
//whether or not compacted data should be moved to the minimum possible level.
540+
ChangeLevel *bool `json:"changeLevel,omitempty"`
541+
// Whether or not to compact the bottommost level of data.
542+
CompactBottomMostLevel *bool `json:"compactBottomMostLevel,omitempty"`
543+
}

0 commit comments

Comments
 (0)