* Tracing: add file exporter to write traces as OTLP/JSON
On-prem operators can share metrics and logs with support easily, but capturing
Grafana's own traces required standing up an OTEL collector and a trace backend
(Tempo/Jaeger). This adds a `file` exporter that writes Grafana's traces to a
local OTLP/JSON file, so an operator can enable it, reproduce an issue, and hand
the file to support with no extra infrastructure. The file is spec-compliant
OTLP/JSON (hex-encoded IDs) and can be visualised directly in Grafana Explore's
"Import trace".
The exporter is off by default and only activates when
[tracing.opentelemetry.file] path is set and no jaeger/otlp endpoint is
configured. Captures are bounded by size and duration (whichever trips first) to
protect the host disk, the file is created owner-only, and any setup failure
disables the exporter rather than blocking startup.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: trigger CI
* Tracing: document Windows limitation of capture file permissions
The 0600 mode on the trace capture file is only effective on Unix; on
Windows the permission bits map to the read-only attribute and effective
access is governed by ACLs inherited from the capture directory. Scope
the confidentiality claim accordingly — operators provision the capture
directory, so its ACLs are the access boundary on Windows.
* Tracing: skip span encoding once the trace capture has ended
After the size or duration cap tripped, every exported batch was still
converted proto -> pdata -> OTLP/JSON before being discarded by the
closed writer, and with the exporter's always-on sampling that cost was
paid for the rest of the process lifetime. Check the writer state first
so post-capture batches are dropped before any encoding happens.
* Tracing: never block startup on a file exporter setup failure
Writer and exporter-client failures already degraded the file exporter
to noop, but sampler and tracer-provider initialization errors still
returned from ProvideService and could prevent Grafana from starting
over an optional support capture. Route those paths through the same
graceful-disable helper (shutting down the already-open exporter) and
add an invalid-sampler regression test.
* Tracing: roll back partial records and end capture on write errors
A transient write failure (e.g. disk full) could leave a partially
written record in the capture file; later batches then appended after
the malformed line, corrupting the remainder of the file — and strict
JSONL consumers reject the whole capture over a single bad line. On any
write error, truncate the file back to the last committed offset and
terminate the capture so the output always remains valid OTLP/JSON.
The writer's file handle is narrowed to a small interface so the
rollback path is testable with a fake failing file.
* chore: trigger CI
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* - Added migration to add a new collumn UID to both migration and migration_run tables.
- Added migration to set UID for records already existent in the database before adding a new column.
- Added UID field to CloudMigration and CloudMigrationRun dtos (model.go)
* Fix db migration
* Updating store and model
* Updating API to use UID
* fix typo
* update openapi specs and generated endpoints
* fix spec
* update openapi specs and generated endpoints
* Fixing db mapping
* Fix frontend
* fix migration
* remove migration uid from run fetch endpoint
* Revert "merge"
This reverts commit d654e4c530, reversing
changes made to 5fe0b483eb.
* manual merge
* rename some funcs for consistency
* make interfaces consistent
* validate uids
* update generated frontend api
* fix enterprise spec
* manually resolve api
* try again
* try yet again
* once more
---------
Co-authored-by: Josh Hunt <joshhunt@users.noreply.github.com>
Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com>
Co-authored-by: joshhunt <josh@trtr.co>
* Add config to remove Snapshot functionality (frontend is hidden and validation in the backend)
* Add test cases
* Remove unused mock on the test
* Moving Snapshot config from globar variables to settings.Cfg
* Removing warnings on code
* Adding OpenApi target to makefile, to covert swagger spec into OpenAPI 3
* Adding endpoint to server swaggerui with new openapi3 specs
* Passing output file as parameter for OpenApi3 specs
* Implement workaround for missing host and prefix domain
* Created PluginSecretMigrationService to be able to migrate from the secrets table from the database to the secret plugin. Added migration which takes all the secrets at the sql store and stores it in the plugin. Then deletes all the secrets from the sql
* Added secretsKVStoreSQL.GetAll() method to return all the secrets at the sql table
* Renaming kvstore_test.go as sql_test.go, adding GetAll test case. Fixing decryption of keys