Skip to content

Commit

Permalink
Start on receiver
Browse files Browse the repository at this point in the history
Started receiver struct and stubbed start and shutdown methods
  • Loading branch information
lewis262626 committed Feb 17, 2023
1 parent ab9d7d5 commit c73718c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
4 changes: 2 additions & 2 deletions receiver/awscloudwatchmetricsreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ awscloudwatchmetrics:
poll_interval: 5m
metrics:
named:
- namespace: /aws/eks/dev-0/cluster:
metric_names: [kube-apiserver-ea9c831555adca1815ae04b87661klasdj]
- namespace: AWS/EC2:
metric_names: [DiskWriteOps,DiskReadBytes]
```
## Sample Configs
Expand Down
5 changes: 4 additions & 1 deletion receiver/awscloudwatchmetricsreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ func createMetricsRceiver(_ context.Context, params receiver.CreateSettings, bas
}

func createDefaultConfig() component.Config {
return &Config{}
return &Config{
PollInterval: defaultPollInterval,
Metrics: &MetricsConfig{},
}
}
2 changes: 1 addition & 1 deletion receiver/awscloudwatchmetricsreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.19
require (
go.opentelemetry.io/collector v0.71.0
go.opentelemetry.io/collector/component v0.71.0
go.opentelemetry.io/collector/consumer v0.71.0
go.uber.org/multierr v1.9.0
)

Expand All @@ -19,7 +20,6 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
go.opentelemetry.io/collector/confmap v0.71.0 // indirect
go.opentelemetry.io/collector/consumer v0.71.0 // indirect
go.opentelemetry.io/collector/featuregate v0.71.0 // indirect
go.opentelemetry.io/collector/pdata v1.0.0-rc5 // indirect
go.opentelemetry.io/otel v1.13.0 // indirect
Expand Down
36 changes: 35 additions & 1 deletion receiver/awscloudwatchmetricsreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,38 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package awscloudwatchmetricsreceiver
package awscloudwatchmetricsreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscloudwatchmetricsreceiver"

import (
"context"
"sync"
"time"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
"go.uber.org/zap"
)

type metricReceiver struct {
region string
profile string
pollInterval time.Duration
nextStartTime time.Time
logger *zap.Logger
consumer consumer.Logs
wg *sync.WaitGroup
doneChan chan bool
}

func (m *metricReceiver) Start(ctx context.Context, host component.Host) error {
m.logger.Debug("Starting to poll for CloudWatch metrics")
m.wg.Add(1)
return nil
}

func (m *metricReceiver) Shutdown(ctx context.Context) error {
m.logger.Debug("Shutting down awscloudwatchmetrics receiver")
close(m.doneChan)
m.wg.Wait()
return nil
}

0 comments on commit c73718c

Please sign in to comment.