Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-enable otel subcommand on Windows #6068

Merged
merged 7 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user’s deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: enhancement

# Change summary; a 80ish characters long description of the change.
summary: re-enable otel subcommand on Windows

# Long description; in case the summary is not enough to describe the change
# this field accommodate a description without length limits.
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
#description:

# Affected component; a word indicating the component this changeset affects.
component: elastic-agent

# PR URL; optional; the PR number that added the changeset.
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
# Please provide it if you are adding a fragment for a different PR.
pr: https://github.com/elastic/elastic-agent/pull/6068

# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
# If not present is automatically filled by the tooling with the issue linked to the PR number.
issue: https://github.com/elastic/elastic-agent/issues/4976
2 changes: 1 addition & 1 deletion internal/pkg/agent/cmd/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func runCollector(cmdCtx context.Context, configFiles []string) error {
stop := make(chan bool)
ctx, cancel := context.WithCancel(cmdCtx)

var stopCollector = func() {
stopCollector := func() {
close(stop)
}

Expand Down
24 changes: 12 additions & 12 deletions internal/pkg/agent/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,6 @@ func run(override cfgOverrider, testingMode bool, fleetInitTimeout time.Duration
service.WaitExecutionDone()
}()

if err := handleUpgrade(); err != nil {
return fmt.Errorf("error checking for and handling upgrade: %w", err)
}

locker := filelock.NewAppLocker(paths.Data(), paths.AgentLockFileName)
if err := locker.TryLock(); err != nil {
return err
}
defer func() {
_ = locker.Unlock()
}()

service.BeforeRun()
defer service.Cleanup()

Expand All @@ -154,6 +142,18 @@ func run(override cfgOverrider, testingMode bool, fleetInitTimeout time.Duration
defer cancel()
go service.ProcessWindowsControlEvents(stopBeat)

if err := handleUpgrade(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

return fmt.Errorf("error checking for and handling upgrade: %w", err)
}

locker := filelock.NewAppLocker(paths.Data(), paths.AgentLockFileName)
if err := locker.TryLock(); err != nil {
return err
}
defer func() {
_ = locker.Unlock()
}()

return runElasticAgent(ctx, cancel, override, stop, testingMode, fleetInitTimeout, modifiers...)
}

Expand Down
2 changes: 0 additions & 2 deletions internal/pkg/agent/cmd/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// or more contributor license agreements. Licensed under the Elastic License 2.0;
// you may not use this file except in compliance with the Elastic License 2.0.

//go:build !windows

package cmd

import (
Expand Down
8 changes: 4 additions & 4 deletions testing/integration/otel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestOtelFileProcessing(t *testing.T) {
Group: Default,
Local: true,
OS: []define.OS{
// input path missing on windows
{Type: define.Windows},
{Type: define.Linux},
{Type: define.Darwin},
},
Expand Down Expand Up @@ -428,7 +428,7 @@ func TestOtelLogsIngestion(t *testing.T) {
Group: Default,
Local: true,
OS: []define.OS{
// input path missing on windows
{Type: define.Windows},
{Type: define.Linux},
{Type: define.Darwin},
},
Expand Down Expand Up @@ -725,7 +725,7 @@ func TestFileBeatReceiver(t *testing.T) {
Group: Default,
Local: true,
OS: []define.OS{
// {Type: define.Windows}, we don't support otel on Windows yet
{Type: define.Windows},
{Type: define.Linux},
{Type: define.Darwin},
},
Expand Down Expand Up @@ -830,7 +830,7 @@ func TestOtelFBReceiverE2E(t *testing.T) {
Group: Default,
Local: true,
OS: []define.OS{
// {Type: define.Windows}, we don't support otel on Windows yet
{Type: define.Windows},
{Type: define.Linux},
{Type: define.Darwin},
},
Expand Down