Skip to content

krakend/krakend-usage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

KrakenD usage module

An anonymous software usage reporter with proof of work.

The KrakenD usage is designed to collect anonymous information from any software and push it to a server, but it was built for KrakenD. Read the blog post. You can use it with the following code in any app:

	if err := Report(
		ctx,
		Options{
			ClusterID:       "clusterId",
			ServerID:        "serverId",
			URL:             "https://my.usage.api.tld",
			Version:         "v1.2.3",
			ExtraPayload:    someExtraPayload,
			ReportLapse:     12 * time.Hour,
			UserAgent:       "foo bar",
			ReportEndpoint:  "/report",
			SessionEndpoint: "/session",
		},
		nil,
	); err != nil {
		t.Error(err)
		return
	}

From the options above, you must implement at least the ClusterID, ServerID, and URL. We recommend using an uuid randomly-generated for the IDs. All the options are documented here.

The processing server for this report is out of the project's scope, but you can get inspiration from the tests.

On KrakenD API gateway, the module is entirely disabled by setting an environment var USAGE_DISABLE=1, but you should decide your strategy to disable it in your application.

Note on v2

The v2 API is not compatible with the previous version, although is pretty similar. Please check the new interface for the required changes.

About

Anonymous usage report module for the KrakenD framework

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages