package report
import "github.com/open-policy-agent/opa/internal/report"
Package report provides functions to report OPA's version information to an external service and process the response.
Index ¶
- Variables
- type DataResponse
- func (dr *DataResponse) IsSet() bool
- func (dr *DataResponse) Pretty() string
- func (dr *DataResponse) Slice() [][2]string
- type GHResponse
- type GHVersionCollector
- func (*GHVersionCollector) RegisterGatherer(_ string, _ Gatherer)
- func (r *GHVersionCollector) SendReport(ctx context.Context) (*DataResponse, error)
- type Gatherer
- type Options
- type ReleaseDetails
- type Reporter
Variables ¶
var ExternalServiceURL = "https://api.github.com"
ExternalServiceURL is the base HTTP URL for a telemetry service. If not otherwise specified, it will use the hard-coded default.
Override at build time via:
-ldflags "-X github.com/open-policy-agent/opa/internal/report.ExternalServiceURL=<url>"
This will be overridden if the OPA_TELEMETRY_SERVICE_URL environment variable is provided.
Types ¶
type DataResponse ¶
type DataResponse struct { Latest ReleaseDetails `json:"latest,omitempty"` }
DataResponse represents the data returned by the external service
func (*DataResponse) IsSet ¶
func (dr *DataResponse) IsSet() bool
IsSet returns true if dr is populated.
func (*DataResponse) Pretty ¶
func (dr *DataResponse) Pretty() string
Pretty returns OPA release information in a human-readable format.
func (*DataResponse) Slice ¶
func (dr *DataResponse) Slice() [][2]string
Slice returns the dr as a slice of key-value string pairs. If dr is nil, this function returns an empty slice.
type GHResponse ¶
type GHResponse struct { TagName string `json:"tag_name,omitempty"` // latest OPA release tag ReleaseNotes string `json:"html_url,omitempty"` // link to the OPA release notes Download string `json:"assets_url,omitempty"` // link to download the OPA release }
type GHVersionCollector ¶
type GHVersionCollector struct {
// contains filtered or unexported fields
}
func (*GHVersionCollector) RegisterGatherer ¶
func (*GHVersionCollector) RegisterGatherer(_ string, _ Gatherer)
func (*GHVersionCollector) SendReport ¶
func (r *GHVersionCollector) SendReport(ctx context.Context) (*DataResponse, error)
SendReport sends the telemetry report which includes information such as the OPA version, current memory usage to the external service
type Gatherer ¶
Gatherer represents a mechanism to inject additional data in the telemetry report
type Options ¶
Options supplies parameters to the reporter.
type ReleaseDetails ¶
type ReleaseDetails struct { Download string `json:"download,omitempty"` // link to download the OPA release ReleaseNotes string `json:"release_notes,omitempty"` // link to the OPA release notes LatestRelease string `json:"latest_release,omitempty"` // latest OPA released version OPAUpToDate bool `json:"opa_up_to_date,omitempty"` // is running OPA version greater than or equal to the latest released }
ReleaseDetails holds information about the latest OPA release
type Reporter ¶
type Reporter interface { SendReport(ctx context.Context) (*DataResponse, error) RegisterGatherer(key string, f Gatherer) }
Reporter reports information such as the version, heap usage about the running OPA instance to an external service
func New ¶
New returns an instance of the Reporter
Source Files ¶
- Version
- v1.7.0
- Published
- Jul 31, 2025
- Platform
- js/wasm
- Imports
- 16 packages
- Last checked
- 1 hour ago –
Tools for package owners.