Skip to content

Commit

Permalink
Merge pull request open-telemetry#21 from chadpatel/may30_refactor_le…
Browse files Browse the repository at this point in the history
…ader_election

Refactor leader election
  • Loading branch information
chadpatel authored May 31, 2023
2 parents 7a68c73 + c12b747 commit 59e2f8d
Show file tree
Hide file tree
Showing 14 changed files with 626 additions and 343 deletions.
3 changes: 2 additions & 1 deletion internal/aws/k8s/k8sclient/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ package k8sclient // import "github.com/open-telemetry/opentelemetry-collector-c
import (
"context"
"fmt"
"sync"

"go.uber.org/zap"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"
"sync"
)

type DaemonSetClient interface {
Expand Down
7 changes: 6 additions & 1 deletion internal/aws/k8s/k8sclient/daemonset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
package k8sclient

import (
"sort"
"testing"

"github.com/stretchr/testify/assert"
"go.uber.org/zap"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes/fake"
"testing"
)

var daemonSetObjects = []runtime.Object{
Expand Down Expand Up @@ -88,6 +90,9 @@ func TestDaemonSetClient(t *testing.T) {
},
}
actual := client.DaemonSetInfos()
sort.Slice(actual, func(i, j int) bool {
return actual[i].Name < actual[j].Name
})
assert.Equal(t, expected, actual)
client.shutdown()
assert.True(t, client.stopped)
Expand Down
3 changes: 2 additions & 1 deletion internal/aws/k8s/k8sclient/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ package k8sclient // import "github.com/open-telemetry/opentelemetry-collector-c
import (
"context"
"fmt"
"sync"

"go.uber.org/zap"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"
"sync"
)

type DeploymentClient interface {
Expand Down
7 changes: 6 additions & 1 deletion internal/aws/k8s/k8sclient/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
package k8sclient

import (
"sort"
"testing"

"github.com/stretchr/testify/assert"
"go.uber.org/zap"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes/fake"
"testing"
)

var desired = int32(20)
Expand Down Expand Up @@ -98,6 +100,9 @@ func TestDeploymentClient(t *testing.T) {
},
}
actual := client.DeploymentInfos()
sort.Slice(actual, func(i, j int) bool {
return actual[i].Name < actual[j].Name
})
assert.Equal(t, expected, actual)
client.shutdown()
assert.True(t, client.stopped)
Expand Down
37 changes: 33 additions & 4 deletions receiver/awscontainerinsightreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ rules:
resources: ["configmaps"]
resourceNames: ["otel-container-insight-clusterleader"]
verbs: ["get","update"]
- nonResourceURLs: ["/metrics"]
verbs: ["get", "list", "watch"]
---
kind: ClusterRoleBinding
Expand Down Expand Up @@ -338,10 +340,19 @@ kubectl apply -f config.yaml

## Available Metrics and Resource Attributes
### Cluster
| Metric | Unit |
|---------------------------|-------|
| cluster_failed_node_count | Count |
| cluster_node_count | Count |
| Metric | Unit |
|------------------------------------------------------------|---------|
| cluster_failed_node_count | Count |
| cluster_node_count | Count |
| apiserver_storage_objects | Count |
| apiserver_request_total | Count |
| apiserver_request_duration_seconds | Seconds |
| apiserver_admission_controller_admission_duration_seconds | Seconds |
| rest_client_request_duration_seconds | Seconds |
| rest_client_requests_total | Count |
| etcd_request_duration_seconds | Seconds |



<br/><br/>
| Resource Attribute |
Expand Down Expand Up @@ -397,6 +408,24 @@ kubectl apply -f config.yaml


<br/><br/>

### Cluster Endpoint
| Metric | Unit |
|-----------------------------|-------|
| etcd_db_total_size_in_bytes | bytes |


<br/><br/>
| Resource Attribute |
|--------------------|
| ClusterName |
| NodeName |
| Endpoint |
| Type |
| Timestamp |
| Version |
| Sources |

<br/><br/>

### Cluster Deployment
Expand Down
Loading

0 comments on commit 59e2f8d

Please sign in to comment.