github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/clients/pkg/promtail/targets/journal/journaltargetmanager.go (about)

     1  //go:build !linux || !cgo
     2  // +build !linux !cgo
     3  
     4  package journal
     5  
     6  import (
     7  	"github.com/go-kit/log"
     8  	"github.com/go-kit/log/level"
     9  
    10  	"github.com/grafana/loki/clients/pkg/promtail/api"
    11  	"github.com/grafana/loki/clients/pkg/promtail/positions"
    12  	"github.com/grafana/loki/clients/pkg/promtail/scrapeconfig"
    13  	"github.com/grafana/loki/clients/pkg/promtail/targets/target"
    14  )
    15  
    16  // JournalTargetManager manages a series of JournalTargets.
    17  // nolint:revive
    18  type JournalTargetManager struct{}
    19  
    20  // NewJournalTargetManager returns nil as JournalTargets are not supported
    21  // on this platform.
    22  func NewJournalTargetManager(
    23  	metrics *Metrics,
    24  	logger log.Logger,
    25  	positions positions.Positions,
    26  	client api.EntryHandler,
    27  	scrapeConfigs []scrapeconfig.Config,
    28  ) (*JournalTargetManager, error) {
    29  	level.Warn(logger).Log("msg", "WARNING!!! Journal target was configured but support for reading the systemd journal is not compiled into this build of promtail!")
    30  	return &JournalTargetManager{}, nil
    31  }
    32  
    33  // Ready always returns false for JournalTargetManager on non-Linux
    34  // platforms.
    35  func (tm *JournalTargetManager) Ready() bool {
    36  	return false
    37  }
    38  
    39  // Stop is a no-op on non-Linux platforms.
    40  func (tm *JournalTargetManager) Stop() {}
    41  
    42  // ActiveTargets always returns nil on non-Linux platforms.
    43  func (tm *JournalTargetManager) ActiveTargets() map[string][]target.Target {
    44  	return nil
    45  }
    46  
    47  // AllTargets always returns nil on non-Linux platforms.
    48  func (tm *JournalTargetManager) AllTargets() map[string][]target.Target {
    49  	return nil
    50  }