Metrics data is stored as structure, HTTP requests logging, got rid of context.

Metrics data now stored as structures. This is a first step for autodiscovery
helping for NMSes.

HTTP requests now logged.

Got rid of context.Context for getting metric data in applications
because context.Context is useless here.
This commit is contained in:
2020-12-23 13:27:17 +05:00
parent de5b55da43
commit 529113a41a
10 changed files with 210 additions and 54 deletions

View File

@@ -1,11 +0,0 @@
package common
// ContextKey is a type of context.Context keys.
type ContextKey string
const (
// ContextKeyApplication specifies that returned value is a name of application.
ContextKeyApplication ContextKey = "applicationName"
// ContextKeyMetric specifies that returned value is a name of metric of application.
ContextKeyMetric ContextKey = "metricName"
)

View File

@@ -1,6 +1,6 @@
package common
import "context"
import "go.dev.pztrn.name/metricator/internal/models"
// HTTPHandlerFunc describes signature of HTTP requests handling function.
type HTTPHandlerFunc func(context.Context) string
type HTTPHandlerFunc func(*models.RequestInfo) string