Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Adds windows support to process agent #96

Merged
merged 23 commits into from
Jan 25, 2018
Merged

Adds windows support to process agent #96

merged 23 commits into from
Jan 25, 2018

Conversation

derekwbrown
Copy link
Collaborator

Generate windows executable for windows process agent.

Adds windows support (w/o wmi) for collecting process stats.
Uses specific branch of datadog/gopsutil
  - Note: hand-edited glide.lock to get correct version.  This is bad.
Adds prelim windows service processing.
Adds version resource on windows
Adds message file for reporting to event viewer
Merge original windows changes.
Make it compile w/o docker
@bits-bot
Copy link

bits-bot commented Jan 16, 2018

CLA assistant check
All committers have signed the CLA.

@derekwbrown derekwbrown force-pushed the db/new_windows branch 4 times, most recently from e276532 to 498b36e Compare January 17, 2018 22:12
Add binary signing
@derekwbrown derekwbrown force-pushed the db/new_windows branch 3 times, most recently from 430dcc4 to 1053270 Compare January 19, 2018 21:07
Copy link
Member

@sunhay sunhay left a comment

Choose a reason for hiding this comment

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

Looks good to me, just a few comments.

If @conorbranagan has time, it'd be nice to have him look over this as well, but I don't think it's a deal-breaker.

glide.yaml Outdated
@@ -1,13 +1,15 @@
package: github.com/DataDog/datadog-process-agent
import:
- package: github.com/DataDog/datadog-agent
version: f1d63c176a934c8b8aefa31e2c7d938b0e50e348
vcs: git
version: db/merge_no_docker
Copy link
Member

Choose a reason for hiding this comment

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

Does it still need to be pinned to this branch, or can we change it to the latest master?

glide.yaml Outdated
version: fb25fcedf155de94e762080a914adb5436d45b9c
- package: github.com/DataDog/gopsutil
vcs: git
version: db/add_windows_checks
Copy link
Member

Choose a reason for hiding this comment

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

Can be pinned to the latest master :)

if err := NewLoggerLevel(cfg.LogLevel, cfg.LogFile); err != nil {
return nil, err
}
//if err := NewLoggerLevel(cfg.LogLevel, cfg.LogFile); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this is entirely correct, so the configuration is completely ignored?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll put it back, but IIRC I did that because it's logging to console no matter what, and on windows, when running as a service console == /dev/null

SystemTime: int64(t2.System),
}
}
func calculatePct(deltaProc, deltaTime, numCPU float64) float32 {
Copy link
Member

Choose a reason for hiding this comment

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

Since this is in both nix + windows, it might make sense to throw this into process.go?

import (
"flag"
"fmt"
// "log"
Copy link
Member

Choose a reason for hiding this comment

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

nit: remove this

uninstallService bool
startService bool
stopService bool
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: can you wrap all of these in a single var() block and clean up the comments with flag code

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure. Something to think about, we use github.com/spf13/cobra on the metrics agent. Might be nice to standardize.

@@ -7,5 +7,5 @@ import "github.com/DataDog/datadog-agent/pkg/util/docker"
// GetContainers is the unique method that returns all containers on the host (or in the task)
// and that other agents can consume so that we don't have to convert all containers to the format.
func GetContainers() ([]*docker.Container, error) {
return *docker.Container{}, nil
return make([]*docker.Container, 0), nil
Copy link
Member

Choose a reason for hiding this comment

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

this can just be nil, nil without any allocation

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@conorbranagan I did it initially with nil,nil; however, there's other code that iterates the return (and crashes). Needs to be empty (so length is zero) I think.

Copy link
Member

Choose a reason for hiding this comment

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

Hm you should be able to iterate on a nil map but maybe there's something weird going on. Not a huge deal either way.

@derekwbrown derekwbrown merged commit 9ec988b into master Jan 25, 2018
@derekwbrown derekwbrown deleted the db/new_windows branch January 25, 2018 15:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants