Commit Graph
31 Commits
Author SHA1 Message Date
Pascal Bleser 5b72318493 chore(graph): add metrics for HTTP API and LDAP
Introducing gowrap as a build-time tool to generate interface delegate
structs from templates:

 * added as a 'make go-generate' target in services/graph,
 * added as a build-time dependency in .bingo/

Introduce an LDAP client abstraction interface to be able to wrap the
go-ldap client API with metrics transparently (and possibly hooks and
such in the future), in order to use delegation patterns to measure the
time LDAP (client) operations take to finish, as well as to track their
results (success, failure, not-found).

Has two implementations that are generated using gowrap:

* a go-ldap adapter implementation that directly delegates to a go-ldap
  connection
* a time measuring and metrics collecting implementation that delegates
  to another LdapClient

The metrics collecting one is disabled by default, can be enabled with
GRAPH_LDAP_METRICS_DISABLE=false

It collects durations of outbound LDAP client operations into a histogram, as
well as the number of concurrent outbound LDAP operations in a gauge (via an
atomic int and a gauge function, as that performs best).

Add an HTTP middleware that measures how long Graph HTTP API requests
take, storing taken time into a histogram along with labels for

 * method,
 * path pattern (from the chi routes),
 * Graph API version prefix,
 * Graph API resource name,
 * and the resulting status code.

It also tracks the number of concurrent inbound Graph API HTTP requests
using a gauge (also using an atomic int and a gauge function).

Disabled by default, can be enabled with
GRAPH_HTTP_METRICS_DISABLE=false

Add Backend and EducationBackend delegate implementations that measure
execution time on the level of the higher API call operations there
(CreateUser, DeleteUser, ..., CreateSchool, ...), generated using
gowrap.

Disabled by default, can be enabled with
GRAPH_IDENTITY_BACKEND_METRICS_DISABLE=false

Also added a small k6 script to produce some read-only load on the Graph
API, for a casual test of the metrics, as well as k6 in mise.toml.

Make an internal changes to how singular LDAP entry searches work in the LDAP
identity backends:

 * check whether searches for a singular entry returns more than one
   result, in which case a new error TooManyResults is returned, instead
   of leaving that undetected, blindly taking the first result, and
   potentially risking data inconsistencies

Improve the loggers in identity backends by adding attributes for their
request targets (Reva gateway address or LDAP URI, respectively).

Also add a "backend" attribute for all Graph API logs (set to "ldap" or
"cs3"), to help debug potential issues, and remove them from all the logger
debug calls at the beginning of each LDAP-related function as those should
really be part of the logger and set beforehand.

The LDAP identity backend logger also has two new attributes to help
debugging with logs:

 * write (bool): whether write operations are enabled
 * refint (bool): whether refint is enabled or not

Also adds a dedicated counter metric for user password change operations.

Minor campfire improvements:

 * add a constructor func for the CS3 backend

 * add a constructor func for the LDAP backend

 * in the LDAP identity backend, in searchLDAPEntryByFilter (used by all
   search/get public functions), errors that occur when performing LDAP
   SEARCH operations were blindly mapped to a ItemNotFound error,
   instead of being analyzed as it could be caused by a technical error

 * in the requireadmin middleware, add debug logging to explain why a
   request is denied

 * when an LDAP password change fails because the user entry was not
   found in LDAP, we now have a log message that tracks that
2026-09-01 10:57:47 +02:00
Pascal Bleser e8cf677353 chore(graph): disable HTTP or eventhandlers by configuration
In the scope of the broader issue #1312, this PR deals with performing
those changes for the `graph` service, namely to add the ability to
disable the HTTP API or to disable the events API handler by
configuration.

It also adds metrics for the events processing, and tests for the events
processing.

The previous implementation was combining the HTTP server service and
the events consumption, which is why this PR refactors the composition
of those services:

 * the event consumption has been moved into its own service
 * the identity.Backend is created beforehand, and then injected as a
   collaborator in both the HTTP service as well as the event consumer
   service

It also adds metrics, mainly for the event processing.

To encourage re-use in latter implementations and changes, it also
introduces two top-level package changes:

 * internal/eventstest/events_test_helpers: contains a TestBus
   implementation to unit-test event consumers without NATS
 * internal/metricstest/metrics_test_helpers: contains assertion
   functions to test Prometheus metrics
2026-09-01 10:57:26 +02:00
Thomas Schweiger fb6ab0f092 enhancement: increase display size of graph flow diagram 2026-04-21 16:51:13 +02:00
Michael BarzandThomas Schweiger 5c7f58c8b5 fix: correct README.md files which contain broken or missing links (#1854)
Co-authored-by: Thomas Schweiger <t.schweiger@opencloud.eu>
2025-11-14 11:22:30 +01:00
LisaHue 86f7be40f9 Updated boxes in readme 2025-06-02 13:30:43 +02:00
Ralf Haferkamp 64224ce18f Fix link to LDAP schema in graph readme 2025-01-29 12:22:47 +01:00
Jannik Stehle a446f2cd71 chore: adjust doc links in graph service readme svg file 2025-01-27 15:33:14 +01:00
Ralf HaferkampandJörn Friedrich Dreyer 5959c3b87e Update services/graph/README.md
Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-16 16:34:58 +01:00
Ralf Haferkamp ceb5e92c28 Rebrand graph service
leaving out LDAP related stuff for now
2025-01-16 15:59:35 +01:00
Jörn Friedrich Dreyer a46fd132bd use OC_ env prefix
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-13 16:11:11 +01:00
jkoberg c80254c4f1 feat(ocis): remove ocm store
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-10-15 17:24:51 +02:00
Ralf HaferkampandMartin 103400f8bf Apply suggestions from code review
Co-authored-by: Martin <github@diemattels.at>
2024-09-17 16:29:31 +02:00
Ralf Haferkamp f0bc37b250 graph(docs): More details for the README
Add some details about the users and groups endpoints provided by
the graph service.
2024-09-17 16:06:24 +02:00
Martin Mattel 313d336522 [docs-only] Fix a typo in graph service readme 2024-09-09 08:08:12 +02:00
Martin Mattel 79aac868cf [docs-only] Description + CLI for Unified Roles Management 2024-09-03 11:03:39 +02:00
jkoberg d335d635b3 feat(graph): add TRANSLATION_PATH envvar
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-08-23 11:08:29 +02:00
kobergjandMartin 423c28b298 improve store readmes
Co-authored-by: Martin <github@diemattels.at>
2023-12-15 13:25:10 +01:00
mmattel 589a0f5ce1 [docs-only] Fix caching envvar use 2023-05-10 11:37:05 +02:00
EParzefall e2686f90b9 spelling fixes 2023-04-24 13:55:10 +02:00
mmattel 84d2d8dae9 [docs-only] Fix texts and typos in README.md files 2023-04-23 10:02:27 +02:00
Martin e58f6d2d7a [docs-only] Update graph readme (GDPR, link to admin docs)
Referencing: https://github.com/owncloud/docs-ocis/pull/457 (Add user triggered GDPR Report)

Linking to the ocis admin documentation because we have more explainaition, images and an example json.
2023-04-19 09:34:31 +02:00
Daniël FrankeandMartin 2e8b741530 improve readme
Co-authored-by: Martin <github@diemattels.at>
2023-04-14 15:09:54 +02:00
Daniël Franke 43cf811db1 Format markdown a bit cleaner. 2023-04-14 15:09:54 +02:00
Daniël Franke ed27261262 Add documentation about keycloak configuration. 2023-04-14 15:09:54 +02:00
mmattel b2504035e0 fix readme service names 2023-04-12 18:40:41 +02:00
Martin 1f86a79a15 Update Graph README.md
An image source referenced must be the raw source to be shown properly in owncloud.dev. No impact on showing the readme here.
2023-04-06 10:48:38 +02:00
mmattel 3c35b95ee2 [docs-only] Fixing the service name in the text used in readme.md 2023-04-04 12:15:59 +02:00
mmattel 255dd06c92 [docs-only] Fix readme.md for caches 2023-04-04 09:15:24 +02:00
Martin ae0588a564 Update graph service readme
References: #5694 

Adding support to use `or` when filtering.
2023-03-02 14:26:00 +01:00
mmattel 40ac4efb0f [docs-only] Alingning the graph service readme with content of the admin docs 2023-03-02 12:31:24 +01:00
David Christofas dc53b39f23 add a README to the graph package 2022-12-05 11:11:25 +01:00