Skip to content

Commit

Permalink
Merge branch 'main' into update-lambda-promtail-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangraham authored Jul 1, 2024
2 parents 3a83e79 + 86fbfff commit 8be4645
Show file tree
Hide file tree
Showing 430 changed files with 110,291 additions and 8,137 deletions.
2 changes: 1 addition & 1 deletion .github/jsonnetfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"subdir": "workflows"
}
},
"version": "124c4d996f9625478a79f1884465e29ea082d224"
"version": "adca1c07a2199374e1646e62331926509699368b"
}
],
"legacyImports": true
Expand Down
4 changes: 2 additions & 2 deletions .github/jsonnetfile.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"subdir": "workflows"
}
},
"version": "124c4d996f9625478a79f1884465e29ea082d224",
"sum": "8wrJURq48ZBAtZcReO1W7AiXmvUyLqb932Q9sXyfFVo="
"version": "adca1c07a2199374e1646e62331926509699368b",
"sum": "/6NMt3DFr1mpaBxncbwBJVV5vBpAMIyP3XNOoFArz5Q="
}
],
"legacyImports": false
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
- name: "download images"
run: |
echo "downloading images to $(pwd)/images"
gsutil cp -r gs://loki-build-artifacts/${{ needs.createRelease.outputs.sha }}/images .
gsutil cp -r gs://${BUILD_ARTIFACTS_BUCKET}/${{ needs.createRelease.outputs.sha }}/images .
- name: "publish docker images"
uses: "./lib/actions/push-images"
with:
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,13 @@ release-workflows:

.PHONY: release-workflows-check
release-workflows-check:
ifeq ($(BUILD_IN_CONTAINER),true)
$(SUDO) docker run $(RM) $(TTY) -i \
-v $(shell go env GOPATH)/pkg:/go/pkg$(MOUNT_FLAGS) \
-v $(shell pwd):/src/loki$(MOUNT_FLAGS) \
$(IMAGE_PREFIX)/loki-build-image:$(BUILD_IMAGE_VERSION) $@;
else
@$(MAKE) release-workflows
@echo "Checking diff"
@git diff --exit-code -- ".github/workflows/*release*" || (echo "Please build release workflows by running 'make release-workflows'" && false)
endif
8 changes: 4 additions & 4 deletions clients/pkg/promtail/discovery/consulagent/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
ticker := time.NewTicker(d.refreshInterval)

// Watched services and their cancellation functions.
services := make(map[string]func())
services := make(map[string]func(error))

for {
select {
Expand All @@ -340,7 +340,7 @@ func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
// Watch the catalog for new services we would like to watch. This is called only
// when we don't know yet the names of the services and need to ask Consul the
// entire list of services.
func (d *Discovery) watchServices(ctx context.Context, ch chan<- []*targetgroup.Group, services map[string]func()) {
func (d *Discovery) watchServices(ctx context.Context, ch chan<- []*targetgroup.Group, services map[string]func(error)) {
agent := d.client.Agent()
level.Debug(d.logger).Log("msg", "Watching services", "tags", strings.Join(d.watchedTags, ","))

Expand Down Expand Up @@ -378,7 +378,7 @@ func (d *Discovery) watchServices(ctx context.Context, ch chan<- []*targetgroup.
continue // We are already watching the service.
}

wctx, cancel := context.WithCancel(ctx)
wctx, cancel := context.WithCancelCause(ctx)
d.watchService(wctx, ch, name)
services[name] = cancel
}
Expand All @@ -390,7 +390,7 @@ func (d *Discovery) watchServices(ctx context.Context, ch chan<- []*targetgroup.
"msg", "removing service since consul no longer has a record of it",
"name", name)
// Call the watch cancellation function.
cancel()
cancel(errors.New("canceling service since consul no longer has a record of it"))
delete(services, name)

// Send clearing target group.
Expand Down
7 changes: 7 additions & 0 deletions cmd/loki/loki-local-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
log_level: debug

common:
instance_addr: 127.0.0.1
Expand Down Expand Up @@ -33,6 +34,12 @@ schema_config:
prefix: index_
period: 24h

pattern_ingester:
enabled: true
metric_aggregation:
enabled: true
log_push_observations: true

ruler:
alertmanager_url: http://localhost:9093

Expand Down
18 changes: 18 additions & 0 deletions cmd/loki/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ func main() {
serverCfg := &config.Server
serverCfg.Log = util_log.InitLogger(serverCfg, prometheus.DefaultRegisterer, false)

if config.InternalServer.Enable {
config.InternalServer.Log = serverCfg.Log
}

// Validate the config once both the config file has been loaded
// and CLI flags parsed.
if err := config.Validate(); err != nil {
Expand Down Expand Up @@ -102,6 +106,8 @@ func main() {
}()
}

setProfilingOptions(config.Profiling)

// Allocate a block of memory to reduce the frequency of garbage collection.
// The larger the ballast, the lower the garbage collection frequency.
// https://github.com/grafana/loki/issues/781
Expand All @@ -123,3 +129,15 @@ func main() {
err = t.Run(loki.RunOpts{StartTime: startTime})
util_log.CheckFatal("running loki", err, util_log.Logger)
}

func setProfilingOptions(cfg loki.ProfilingConfig) {
if cfg.BlockProfileRate > 0 {
runtime.SetBlockProfileRate(cfg.BlockProfileRate)
}
if cfg.CPUProfileRate > 0 {
runtime.SetCPUProfileRate(cfg.CPUProfileRate)
}
if cfg.MutexProfileFraction > 0 {
runtime.SetMutexProfileFraction(cfg.MutexProfileFraction)
}
}
Loading

0 comments on commit 8be4645

Please sign in to comment.