nlsfi / hakunapi

OGC API Features Java server
https://github.com/nlsfi/hakunapi
MIT License
12 stars 3 forks source link

Feature request: Add a generic configurable usage monitor/telemetry for operations GetCollectionItems, GetCollectionItemById #90

Closed nls-jajuko closed 9 months ago

nls-jajuko commented 10 months ago

Feature request

Implement generic, extendable and configurable telemetry/usage monitor for operations GetCollectionItems, GetCollectionItemById.

Add interfaces to hakunapi-core Add basic logging telemetry implementation as hakunapi-telemetry module. Add webapp with telemetry as hakunapi-telemetry-webapp-javax module

Add a basic implementation based on SLF4J/Log4j Add a configurable OpenTelemetry appender for SLF4J.

Basic operations Add functionality around GetCollectionItems and GetCollectionItemById to support storing request-response information to a Span. Store Span as JSON record for each request with collection response counts and a configurable set of headers from HTTP request

2024-01-18 12:44:52.828|INFO |fi.nls.hakunapi.telemetry.items||{"username":"<username>", "example-collection":15 "}

Logging configuration

Service configuration

telemetry.mode=json
telemetry.logger=fi.nls.hakunapi.telemetry
telemetry.collections=example-collection,...
telemetry.fields=username,...
telemetry.fields.username.header=remote-user

Optional opentelemetry implementation

Add functionality and configuration to connect SLF4J to opentelemetry appender