Skip to content

Commit

Permalink
promtail: documented client's batch struct and improved tenant stage …
Browse files Browse the repository at this point in the history
…config pointer usage
  • Loading branch information
pracucci committed Nov 6, 2019
1 parent 4fbcb25 commit 34e55d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/logentry/stages/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ func validateTenantConfig(c TenantConfig) error {

// newTenantStage creates a new tenant stage to override the tenant ID from extracted data
func newTenantStage(logger log.Logger, configs interface{}) (*tenantStage, error) {
cfg := &TenantConfig{}
err := mapstructure.Decode(configs, cfg)
cfg := TenantConfig{}
err := mapstructure.Decode(configs, &cfg)
if err != nil {
return nil, err
}

err = validateTenantConfig(*cfg)
err = validateTenantConfig(cfg)
if err != nil {
return nil, err
}

return &tenantStage{
cfg: *cfg,
cfg: cfg,
logger: logger,
}, nil
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/promtail/client/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import (
"github.com/prometheus/common/model"
)

// batch holds pending log streams waiting to be sent to Loki, and it's used
// to reduce the number of push requests to Loki aggregating multiple log streams
// and entries in a single batch request. In case of multi-tenant Promtail, log
// streams for each tenant are stored in a dedicated batch.
type batch struct {
streams map[model.Fingerprint]*logproto.Stream
bytes int
Expand Down

0 comments on commit 34e55d2

Please sign in to comment.