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

Initial introduction of AWS CloudWatch Metrics and Log sources #238

Merged
merged 20 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Remove reference to slice, check for length
  • Loading branch information
antoineco committed Dec 17, 2020
commit 81c672742f4e80c9224918613f39a835755a2fd9
7 changes: 5 additions & 2 deletions pkg/apis/sources/v1alpha1/awscloudwatch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type AWSCloudWatchSourceSpec struct {
Region string `json:"region"`
// List of metric queries
// +optional
MetricQueries *[]AWSCloudWatchMetricQueries `json:"metricQueries,omitempty"`
MetricQueries []AWSCloudWatchMetricQueries `json:"metricQueries,omitempty"`
// PollingFrequency in a duration format for how often to pull metrics data from. Default is 5m
// +optional
PollingFrequency *apis.Duration `json:"pollingFrequency,omitempty"`
Expand All @@ -66,7 +66,10 @@ type AWSCloudWatchSourceSpec struct {
type AWSCloudWatchMetricQueries struct {
antoineco marked this conversation as resolved.
Show resolved Hide resolved
// Unique short-name identify the query
Name string `json:"name"`
// Math expression for calculating metrics. Can have this or a metric

// Optional: no more than one of the following may be specified.

// Math expression for calculating metrics
// +optional
Expression *string `json:"expression,omitempty"`
// Metric for retrieving specific metrics
Expand Down
10 changes: 3 additions & 7 deletions pkg/apis/sources/v1alpha1/deepcopy_generated.go

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

2 changes: 1 addition & 1 deletion pkg/reconciler/awscloudwatchsource/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func adapterDeploymentBuilder(src *v1alpha1.AWSCloudWatchSource, cfg *adapterCon
}

var queries string
if src.Spec.MetricQueries != nil {
if len(src.Spec.MetricQueries) > 0 {
q, err := json.Marshal(src.Spec.MetricQueries)
if err != nil {
logging.FromContext(cfg.context).Errorw("Unable to obtain metrics: ", zap.Error(err))
antoineco marked this conversation as resolved.
Show resolved Hide resolved
Expand Down