-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
946 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package cloudwatchrunner | ||
|
||
import ( | ||
"github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/job/listmetrics" | ||
"github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" | ||
) | ||
|
||
type CustomNamespaceJob struct { | ||
Job model.CustomNamespaceJob | ||
} | ||
|
||
func (c CustomNamespaceJob) Namespace() string { | ||
return c.Job.Namespace | ||
} | ||
|
||
func (c CustomNamespaceJob) listMetricsParams() listmetrics.ProcessingParams { | ||
return listmetrics.ProcessingParams{ | ||
Namespace: c.Job.Namespace, | ||
Metrics: c.Job.Metrics, | ||
RecentlyActiveOnly: c.Job.RecentlyActiveOnly, | ||
DimensionNameRequirements: c.Job.DimensionNameRequirements, | ||
} | ||
} | ||
|
||
func (c CustomNamespaceJob) CustomTags() []model.Tag { | ||
return c.Job.CustomTags | ||
} | ||
|
||
func (c CustomNamespaceJob) resourceEnrichment() ResourceEnrichment { | ||
// TODO add implementation in followup | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cloudwatchrunner | ||
|
||
import ( | ||
"github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/job/listmetrics" | ||
"github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" | ||
) | ||
|
||
type DiscoveryJob struct { | ||
Job model.DiscoveryJob | ||
Resources []*model.TaggedResource | ||
} | ||
|
||
func (d DiscoveryJob) Namespace() string { | ||
return d.Job.Type | ||
} | ||
|
||
func (d DiscoveryJob) CustomTags() []model.Tag { | ||
return d.Job.CustomTags | ||
} | ||
|
||
func (d DiscoveryJob) listMetricsParams() listmetrics.ProcessingParams { | ||
return listmetrics.ProcessingParams{ | ||
Namespace: d.Job.Type, | ||
Metrics: d.Job.Metrics, | ||
RecentlyActiveOnly: d.Job.RecentlyActiveOnly, | ||
DimensionNameRequirements: d.Job.DimensionNameRequirements, | ||
} | ||
} | ||
|
||
func (d DiscoveryJob) resourceEnrichment() ResourceEnrichment { | ||
// TODO add implementation in followup | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cloudwatchrunner | ||
|
||
import ( | ||
"github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/job/listmetrics" | ||
"github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/job/resourcemetadata" | ||
"github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/logging" | ||
"github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" | ||
) | ||
|
||
type ResourceEnrichment interface { | ||
Create(logger logging.Logger) resourcemetadata.MetricResourceEnricher | ||
} | ||
|
||
type Job interface { | ||
Namespace() string | ||
CustomTags() []model.Tag | ||
listMetricsParams() listmetrics.ProcessingParams | ||
resourceEnrichment() ResourceEnrichment | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package listmetrics | ||
|
||
import "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" | ||
|
||
type ProcessingParams struct { | ||
Namespace string | ||
Metrics []*model.MetricConfig | ||
RecentlyActiveOnly bool | ||
DimensionNameRequirements []string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package resourcemetadata | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" | ||
) | ||
|
||
type Resource struct { | ||
// Name is an identifiable value for the resource and is variable dependent on the match made | ||
// It will be the AWS ARN (Amazon Resource Name) if a unique resource was found | ||
// It will be "global" if a unique resource was not found | ||
// CustomNamespaces will have the custom namespace Name | ||
Name string | ||
// Tags is a set of tags associated to the resource | ||
Tags []model.Tag | ||
} | ||
|
||
type Resources struct { | ||
StaticResource *Resource | ||
AssociatedResources []*Resource | ||
} | ||
|
||
type MetricResourceEnricher interface { | ||
Enrich(ctx context.Context, metrics []*model.Metric) ([]*model.Metric, Resources) | ||
} |
Oops, something went wrong.