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

Split metrics on last client write #116

Merged
merged 5 commits into from
Jun 4, 2020
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
2 changes: 1 addition & 1 deletion staging/kos/cmd/attachment-tput-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ func (slot *Slot) close(VNI uint32, nsName string) *netv1a1.NetworkAttachment {
}
c2t.ObserveAt(slot.testedTime.Sub(slot.preCreateTime).Seconds(), nsName, slot.natt.Name)
r2t.ObserveAt(slot.testedTime.Sub(slot.readyTime).Seconds(), nsName, slot.natt.Name)
testCounts.With(prometheus.Labels{esLabel: strconv.FormatInt(int64(slot.testES), 10), lgComplaintsLabel: strconv.FormatInt(int64(slot.testLgComplaints), 10), fullLabel: strconv.FormatBool(slot.fullTest)}).Inc()
testCounts.WithLabelValues(strconv.FormatInt(int64(slot.testES), 10), strconv.FormatInt(int64(slot.testLgComplaints), 10), strconv.FormatBool(slot.fullTest)).Inc()
}
if slot.addressedTime == (time.Time{}) {
glog.Infof("Attachment got no address: attachment=%s/%s, VNI=%06x, node=%s\n", nsName, slot.currentAttachmentName, VNI, slot.currentNodeName)
Expand Down
5 changes: 5 additions & 0 deletions staging/kos/pkg/apis/network/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ type NetworkAttachmentStatus struct {
// +optional
Errors NetworkAttachmentErrors

// SubnetCreationTime is the API server write time of the SubnetSectionSpec
// of the subnet identified by NetworkAttachmentSpec.Subnet.
// +optional
SubnetCreationTime metav1.MicroTime
matte21 marked this conversation as resolved.
Show resolved Hide resolved

// AddressContention indicates whether the address assignment was
// delayed due to not enough addresses being available at first.
AddressContention bool
Expand Down
21 changes: 13 additions & 8 deletions staging/kos/pkg/apis/network/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,39 +221,44 @@ type NetworkAttachmentStatus struct {
// +optional
Errors NetworkAttachmentErrors `json:"errors,omitempty" protobuf:"bytes,1,opt,name=errors"`

// SubnetCreationTime is the API server write time of the SubnetSectionSpec
// of the subnet identified by NetworkAttachmentSpec.Subnet.
// +optional
SubnetCreationTime metav1.MicroTime `json:"subnetCreationTime,omitempty" protobuf:"bytes,2,opt,name=subnetCreationTime"`

// AddressContention indicates whether the address assignment was
// delayed due to not enough addresses being available at first.
AddressContention bool `json:"addressDelayed,omitempty" protbuf:"bytes,9,opt,name=addressDelayed"`
AddressContention bool `json:"addressContention,omitempty" protobuf:"bytes,3,opt,name=addressContention"`

// LockUID is the UID of the IPLock object holding this attachment's
// IP address, or the empty string when there is no address.
// This field is a private detail of the implementation, not really
// part of the public API.
// +optional
LockUID string `json:"lockUID,omitempty" protobuf:"bytes,2,opt,name=lockUID"`
LockUID string `json:"lockUID,omitempty" protobuf:"bytes,4,opt,name=lockUID"`

// AddressVNI is the VNI associated with this attachment's
// IP address assignment, or the empty string when there is no address.
// +optional
AddressVNI uint32 `json:"addressVNI,omitempty" protobuf:"bytes,3,opt,name=addressVNI"`
AddressVNI uint32 `json:"addressVNI,omitempty" protobuf:"bytes,5,opt,name=addressVNI"`

// IPv4 is non-empty when an address has been assigned.
// +optional
IPv4 string `json:"ipv4,omitempty" protobuf:"bytes,4,opt,name=ipv4"`
IPv4 string `json:"ipv4,omitempty" protobuf:"bytes,6,opt,name=ipv4"`

// MACAddress is non-empty while there is a corresponding Linux
// network interface on the host.
// +optional
MACAddress string `json:"macAddress,omitempty" protobuf:"bytes,5,opt,name=macAddress"`
MACAddress string `json:"macAddress,omitempty" protobuf:"bytes,7,opt,name=macAddress"`

// IfcName is the name of the network interface that implements this
// attachment on its node, or the empty string to indicate no
// implementation.
// +optional
IfcName string `json:"ifcName,omitempty" protobuf:"bytes,6,opt,name=ifcname"`
IfcName string `json:"ifcName,omitempty" protobuf:"bytes,8,opt,name=ifcname"`
// HostIP is the IP address of the node the attachment is bound to.
// +optional
HostIP string `json:"hostIP,omitempty" protobuf:"bytes,7,opt,name=hostIP"`
HostIP string `json:"hostIP,omitempty" protobuf:"bytes,9,opt,name=hostIP"`

// PostCreateExecReport, if non-nil, reports on the run of the
// PostCreateExec that was launched when the Linux network
Expand All @@ -266,7 +271,7 @@ type NetworkAttachmentStatus struct {
// PostCreateExec of the attachment for whom the Linux network
// interface was first created.
// +optional
PostCreateExecReport *ExecReport `json:"postCreateExecReport,omitempty" protobuf:"bytes,8,opt,name=postCreateExecReport"`
PostCreateExecReport *ExecReport `json:"postCreateExecReport,omitempty" protobuf:"bytes,10,opt,name=postCreateExecReport"`
}

type NetworkAttachmentErrors struct {
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.

1 change: 1 addition & 0 deletions staging/kos/pkg/apis/network/zz_generated.deepcopy.go

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

10 changes: 6 additions & 4 deletions staging/kos/pkg/controllers/connectionagent/attachment_execs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import (
"syscall"
"time"

"github.com/prometheus/client_golang/prometheus"

k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8stypes "k8s.io/apimachinery/pkg/types"
"k8s.io/klog"
Expand Down Expand Up @@ -108,8 +106,12 @@ func (c *ConnectionAgent) runCommand(attNSN k8stypes.NamespacedName, ifc netfabr
}
exitStatusStr := strconv.FormatInt(int64(cr.ExitStatus), 10)
lgComplaintsStr := strconv.FormatInt(int64(bits.Len(complaints)-1), 10)
c.attachmentExecDurationHistograms.With(prometheus.Labels{"what": what, "exitStatus": exitStatusStr, "lgComplaints": lgComplaintsStr}).Observe(stopTime.Sub(startTime).Seconds())
c.attachmentExecStatusCounts.With(prometheus.Labels{"what": what, "exitStatus": exitStatusStr, "lgComplaints": lgComplaintsStr}).Inc()
c.attachmentExecDurationHistograms.
WithLabelValues(what, exitStatusStr, lgComplaintsStr).
Observe(stopTime.Sub(startTime).Seconds())
c.attachmentExecStatusCounts.
WithLabelValues(what, exitStatusStr, lgComplaintsStr).
Inc()
klog.V(4).Infof("Exec report: att=%s, vni=%06x, ipv4=%s, ifcName=%s, mac=%s, what=%s, report=%#+v", attNSN, ifc.VNI, ifc.GuestIP, ifc.Name, ifc.GuestMAC, what, cr)
if setExecReport != nil {
setExecReport(cr)
Expand Down
Loading