forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement new receiver to add prometheus scraper for Kueue metrics (#253
) Implement new receiver to add prometheus scraper for Kueue metrics (#253)
- Loading branch information
1 parent
2091941
commit cb251fe
Showing
15 changed files
with
2,104 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: 'new_component' | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: awscontainerinsightskueuereceiver | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: "Adds receiver that sets up Prometheus scraper to collect select Kueue metrics." | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [1] # TODO: PR number in staging is 1. Maybe this needs to be changed to something else. | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: Implements a Prometheus scraper to collect Kueue metrics from the Kueue controller manager | | ||
service if Kueue is installed. | ||
|
||
# e.g. '[aws]' | ||
# Include 'aws' if the change is done done by cwa | ||
# Default: '[user]' | ||
change_logs: [rvasahu-amazon] |
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
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 @@ | ||
include ../../Makefile.Common |
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,18 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package awscontainerinsightskueuereceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver" | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// Config defines configuration for aws ecs container metrics receiver. | ||
type Config struct { | ||
// CollectionInterval is the interval at which metrics should be collected. The default is 60 second. | ||
CollectionInterval time.Duration `mapstructure:"collection_interval"` | ||
|
||
// ClusterName can be used to explicitly provide the Cluster's Name for scenarios where it's not | ||
// possible to auto-detect it using EC2 tags. | ||
ClusterName string `mapstructure:"cluster_name"` | ||
} |
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,58 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package awscontainerinsightskueuereceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver" | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"go.opentelemetry.io/collector/component" | ||
"go.opentelemetry.io/collector/consumer" | ||
"go.opentelemetry.io/collector/receiver" | ||
) | ||
|
||
const ( | ||
kueueMetricsStability = component.StabilityLevelDevelopment | ||
) | ||
|
||
var ( | ||
receiverType component.Type = component.MustNewType("awscontainerinsightskueuereceiver") | ||
) | ||
|
||
// Factory for awscontainerinsightreceiver | ||
const ( | ||
// Default collection interval. Every 60s the receiver will collect metrics | ||
defaultCollectionInterval = 60 * time.Second | ||
|
||
// Rely on EC2 tags to auto-detect cluster name by default | ||
defaultClusterName = "" | ||
) | ||
|
||
// NewFactory creates a factory for AWS container insight receiver | ||
func NewFactory() receiver.Factory { | ||
return receiver.NewFactory( | ||
receiverType, | ||
createDefaultConfig, | ||
receiver.WithMetrics(createMetricsReceiver, kueueMetricsStability)) | ||
} | ||
|
||
// createDefaultConfig returns a default config for the receiver. | ||
func createDefaultConfig() component.Config { | ||
return &Config{ | ||
CollectionInterval: defaultCollectionInterval, | ||
ClusterName: defaultClusterName, | ||
} | ||
} | ||
|
||
// CreateMetricsReceiver creates an AWS Container Insight receiver. | ||
func createMetricsReceiver( | ||
_ context.Context, | ||
params receiver.Settings, | ||
baseCfg component.Config, | ||
consumer consumer.Metrics, | ||
) (receiver.Metrics, error) { | ||
|
||
rCfg := baseCfg.(*Config) | ||
return newAWSContainerInsightReceiver(params.TelemetrySettings, rCfg, consumer) | ||
} |
Oops, something went wrong.