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

[chore] Spelling receiver/h...k #37608

Merged
merged 25 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// Config relating to Disk Metric Scraper.
type Config struct {
// MetricsbuilderConfig allows to customize scraped metrics/attributes representation.
// MetricsBuilderConfig allows to customize scraped metrics/attributes representation.
metadata.MetricsBuilderConfig `mapstructure:",squash"`

// Include specifies a filter on the devices that should be included from the generated metrics.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ func TestScrape(t *testing.T) {
IncludeVirtualFS: true,
IncludeFSTypes: FSTypeMatchConfig{Config: filterset.Config{MatchType: filterset.Strict}, FSTypes: []string{"tmpfs"}},
},
partitionsFunc: func(_ context.Context, includeVirtual bool) (paritions []disk.PartitionStat, err error) {
paritions = append(paritions, disk.PartitionStat{Device: "root-device", Fstype: "ext4"})
partitionsFunc: func(_ context.Context, includeVirtual bool) (partitions []disk.PartitionStat, err error) {
partitions = append(partitions, disk.PartitionStat{Device: "root-device", Fstype: "ext4"})
if includeVirtual {
paritions = append(paritions, disk.PartitionStat{Device: "shm", Fstype: "tmpfs"})
partitions = append(partitions, disk.PartitionStat{Device: "shm", Fstype: "tmpfs"})
}
return paritions, err
return partitions, err
},
usageFunc: func(context.Context, string) (*disk.UsageStat, error) {
return &disk.UsageStat{}, nil
Expand Down Expand Up @@ -267,15 +267,15 @@ func TestScrape(t *testing.T) {
newErrRegex: "^error creating exclude_fs_types filter:",
},
{
name: "Invalid Include Moountpoints Filter",
name: "Invalid Include Mountpoints Filter",
config: Config{
MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(),
IncludeMountPoints: MountPointMatchConfig{MountPoints: []string{"test"}},
},
newErrRegex: "^error creating include_mount_points filter:",
},
{
name: "Invalid Exclude Moountpoints Filter",
name: "Invalid Exclude Mountpoints Filter",
config: Config{
MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(),
ExcludeMountPoints: MountPointMatchConfig{MountPoints: []string{"test"}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestScrape(t *testing.T) {
resultsMapLock := sync.Mutex{}

testFn := func(t *testing.T, test testCase) {
// wait for messurement to start
// wait for measurement to start
<-startChan

scraper := newLoadScraper(context.Background(), scrapertest.NewNopSettings(), test.config)
Expand Down Expand Up @@ -179,7 +179,7 @@ func assertCompareAveragePerCPU(t *testing.T, average pmetric.Metric, standard p
// For hardware with only 1 cpu, results must be very close
assert.InDelta(t, valAverage, valStandard, 0.1)
} else {
// For hardward with multiple CPU, average per cpu is fatally less than standard
// For hardware with multiple CPU, average per cpu is fatally less than standard
assert.Less(t, valAverage, valStandard)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func createMetricsScraper(
cfg component.Config,
) (scraper.Metrics, error) {
if runtime.GOOS != "linux" && runtime.GOOS != "windows" && runtime.GOOS != "darwin" {
return nil, errors.New("process scraper only available on Linux, Windows, or MacOS")
return nil, errors.New("process scraper only available on Linux, Windows, or macOS")
}

s, err := newProcessScraper(settings, cfg.(*Config))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ import (
)

func NewManager() Manager {
return &handleCountManager{queryer: wmiHandleCountQueryer{}}
return &handleCountManager{querier: wmiHandleCountQuerier{}}
}

var (
ErrNoHandleCounts = errors.New("no handle counts are currently registered")
ErrNoHandleCountForProcess = errors.New("no handle count for process")
)

type handleCountQueryer interface {
type handleCountQuerier interface {
queryProcessHandleCounts() (map[int64]uint32, error)
}

type handleCountManager struct {
queryer handleCountQueryer
querier handleCountQuerier
handleCounts map[int64]uint32
}

func (m *handleCountManager) Refresh() error {
handleCounts, err := m.queryer.queryProcessHandleCounts()
handleCounts, err := m.querier.queryProcessHandleCounts()
if err != nil {
return err
}
Expand All @@ -50,15 +50,15 @@ func (m *handleCountManager) GetProcessHandleCount(pid int64) (uint32, error) {
return handleCount, nil
}

type wmiHandleCountQueryer struct{}
type wmiHandleCountQuerier struct{}

//revive:disable-next-line:var-naming
type Win32_Process struct {
ProcessID int64
HandleCount uint32
}

func (wmiHandleCountQueryer) queryProcessHandleCounts() (map[int64]uint32, error) {
func (wmiHandleCountQuerier) queryProcessHandleCounts() (map[int64]uint32, error) {
handleCounts := []Win32_Process{}
// creates query `get-wmiobject -query "select ProcessId, HandleCount from Win32_Process"`
// based on reflection of Win32_Process type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ func TestHandleCountManager(t *testing.T) {
assert.Contains(t, err.Error(), "3")
}

type mockQueryer struct {
type mockQuerier struct {
info map[int64]uint32
}

func (s mockQueryer) queryProcessHandleCounts() (map[int64]uint32, error) {
func (s mockQuerier) queryProcessHandleCounts() (map[int64]uint32, error) {
return s.info, nil
}

func deterministicManagerWithInfo(info map[int64]uint32) *handleCountManager {
return &handleCountManager{
queryer: mockQueryer{info: info},
querier: mockQuerier{info: info},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func createMetricsScraper(
cfg component.Config,
) (scraper.Metrics, error) {
if runtime.GOOS != "linux" && runtime.GOOS != "windows" && runtime.GOOS != "darwin" {
return nil, errors.New("uptime scraper only available on Linux, Windows, or MacOS")
return nil, errors.New("uptime scraper only available on Linux, Windows, or macOS")
}

uptimeScraper := newUptimeScraper(ctx, settings, cfg.(*Config))
Expand Down
2 changes: 1 addition & 1 deletion receiver/httpcheckreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[k8s]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-k8s
<!-- end autogenerated section -->

The HTTP Check Receiver can be used for synthethic checks against HTTP endpoints. This receiver will make a request to the specified `endpoint` using the
The HTTP Check Receiver can be used for synthetic checks against HTTP endpoints. This receiver will make a request to the specified `endpoint` using the
configured `method`. This scraper generates a metric with a label for each HTTP response status class with a value of `1` if the status code matches the
class. For example, the following metrics will be generated if the endpoint returned a `200`:

Expand Down
4 changes: 2 additions & 2 deletions receiver/huaweicloudcesreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ The following settings are required:

- `no_verify_ssl`: A boolean flag indicating whether SSL verification should be disabled. Set to True to disable SSL verification.

- `access_key`: The access key needed for CES authentification. Check `Huawei Cloud SDK Authentication Setup` section for more details.
- `access_key`: The access key needed for CES authentication. Check `Huawei Cloud SDK Authentication Setup` section for more details.

- `secret_key`: The secret key needed for CES authentification. Check `Huawei Cloud SDK Authentication Setup` section for more details.
- `secret_key`: The secret key needed for CES authentication. Check `Huawei Cloud SDK Authentication Setup` section for more details.

The following settings are optional:

Expand Down
2 changes: 1 addition & 1 deletion receiver/huaweicloudcesreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (rcvr *cesReceiver) listMetricDefinitions(ctx context.Context) ([]model.Met

// listDataPoints retrieves data points for a list of metric definitions.
// The function performs the following operations:
// 1. Generates a unique key for each metric definition (at least one dimenstion is required) and checks for duplicates.
// 1. Generates a unique key for each metric definition (at least one dimension is required) and checks for duplicates.
// 2. Determines the time range (from-to) for fetching the metric data points, using the current timestamp
// and the last-seen timestamp for each metric.
// 3. Fetches data points for each metric definition.
Expand Down
4 changes: 2 additions & 2 deletions receiver/k8sclusterreceiver/informer_transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/demonset"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/daemonset"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/deployment"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/jobs"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/node"
Expand All @@ -33,7 +33,7 @@ func transformObject(object any) (any, error) {
case *appsv1.Deployment:
return deployment.Transform(o), nil
case *appsv1.DaemonSet:
return demonset.Transform(o), nil
return daemonset.Transform(o), nil
case *appsv1.StatefulSet:
return statefulset.Transform(o), nil
case *corev1.Service:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/clusterresourcequota"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/cronjob"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/demonset"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/daemonset"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/deployment"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/gvk"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/hpa"
Expand Down Expand Up @@ -88,7 +88,7 @@ func (dc *DataCollector) CollectMetricData(currentTime time.Time) pmetric.Metric
replicaset.RecordMetrics(dc.metricsBuilder, o.(*appsv1.ReplicaSet), ts)
})
dc.metadataStore.ForEach(gvk.DaemonSet, func(o any) {
demonset.RecordMetrics(dc.metricsBuilder, o.(*appsv1.DaemonSet), ts)
daemonset.RecordMetrics(dc.metricsBuilder, o.(*appsv1.DaemonSet), ts)
})
dc.metadataStore.ForEach(gvk.StatefulSet, func(o any) {
statefulset.RecordMetrics(dc.metricsBuilder, o.(*appsv1.StatefulSet), ts)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package demonset // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/demonset"
package daemonset // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/daemonset"

import (
"go.opentelemetry.io/collector/pdata/pcommon"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package demonset
package daemonset

import (
"path/filepath"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package demonset
package daemonset

import (
"testing"
Expand Down
6 changes: 3 additions & 3 deletions receiver/k8sclusterreceiver/internal/pod/pods_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestPodAndContainerMetricsReportCPUMetrics(t *testing.T) {
pod := testutils.NewPodWithContainer(
"1",
testutils.NewPodSpecWithContainer("container-name"),
testutils.NewPodStatusWithContainer("container-name", containerIDWithPreifx("container-id")),
testutils.NewPodStatusWithContainer("container-name", containerIDWithPrefix("container-id")),
)

ts := pcommon.Timestamp(time.Now().UnixNano())
Expand All @@ -63,7 +63,7 @@ func TestPodStatusReasonAndContainerMetricsReportCPUMetrics(t *testing.T) {
pod := testutils.NewPodWithContainer(
"1",
testutils.NewPodSpecWithContainer("container-name"),
testutils.NewEvictedTerminatedPodStatusWithContainer("container-name", containerIDWithPreifx("container-id")),
testutils.NewEvictedTerminatedPodStatusWithContainer("container-name", containerIDWithPrefix("container-id")),
)

mbc := metadata.DefaultMetricsBuilderConfig()
Expand All @@ -87,7 +87,7 @@ func TestPodStatusReasonAndContainerMetricsReportCPUMetrics(t *testing.T) {
)
}

var containerIDWithPreifx = func(containerID string) string {
var containerIDWithPrefix = func(containerID string) string {
return "docker://" + containerID
}

Expand Down
2 changes: 1 addition & 1 deletion receiver/k8sclusterreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func TestReceiverWithMetadata(t *testing.T) {
deletePods(t, client, 1)

// Ensure ConsumeKubernetesMetadata is called twice, once for the add and
// then for the update. Note the second update does not result in metatada call
// then for the update. Note the second update does not result in metadata call
// since the pod is not changed.
require.Eventually(t, func() bool {
return int(numCalls.Load()) == 2
Expand Down
4 changes: 2 additions & 2 deletions receiver/k8sclusterreceiver/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/cronjob"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/demonset"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/daemonset"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/deployment"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/gvk"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/hpa"
Expand Down Expand Up @@ -305,7 +305,7 @@ func (rw *resourceWatcher) objMetadata(obj any) map[experimentalmetricmetadata.R
case *appsv1.ReplicaSet:
return replicaset.GetMetadata(o)
case *appsv1.DaemonSet:
return demonset.GetMetadata(o)
return daemonset.GetMetadata(o)
case *appsv1.StatefulSet:
return statefulset.GetMetadata(o)
case *batchv1.Job:
Expand Down
2 changes: 1 addition & 1 deletion receiver/k8sobjectsreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func TestWatchObject(t *testing.T) {
assert.NoError(t, r.Shutdown(ctx))
}

func TestExludeDeletedTrue(t *testing.T) {
func TestExcludeDeletedTrue(t *testing.T) {
t.Parallel()

mockClient := newMockDynamicClient()
Expand Down
8 changes: 4 additions & 4 deletions receiver/k8sobjectsreceiver/unstructured_to_logdata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,24 +177,24 @@ func TestUnstructuredListToLogData(t *testing.T) {
k8sNamespace.Str(),
)

watchEvenLogRecordtAttrs := logEntryFromWatchEvent.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes()
eventType, ok := watchEvenLogRecordtAttrs.Get("event.name")
watchEvenLogRecordAttrs := logEntryFromWatchEvent.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes()
eventType, ok := watchEvenLogRecordAttrs.Get("event.name")
assert.True(t, ok)
assert.Equal(
t,
"generic-name",
eventType.AsString(),
)

eventDomain, ok := watchEvenLogRecordtAttrs.Get("event.domain")
eventDomain, ok := watchEvenLogRecordAttrs.Get("event.domain")
assert.True(t, ok)
assert.Equal(
t,
"k8s",
eventDomain.AsString(),
)

k8sResourceName, ok := watchEvenLogRecordtAttrs.Get("k8s.resource.name")
k8sResourceName, ok := watchEvenLogRecordAttrs.Get("k8s.resource.name")
assert.True(t, ok)
assert.Equal(
t,
Expand Down
2 changes: 1 addition & 1 deletion receiver/kafkametricsreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ log retention size of a topic in Bytes, The value (-1) indicates infinite size.

### kafka.topic.min_insync_replicas

minimum insync replicas of a topic.
minimum in-sync replicas of a topic.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
Expand Down

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

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

2 changes: 1 addition & 1 deletion receiver/kafkametricsreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ metrics:
attributes: [topic]
kafka.topic.min_insync_replicas:
enabled: false
description: minimum insync replicas of a topic.
description: minimum in-sync replicas of a topic.
unit: "{replicas}"
gauge:
value_type: int
Expand Down
6 changes: 3 additions & 3 deletions receiver/kafkametricsreceiver/scraper_test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ func newMockClusterAdmin() *mockClusterAdmin {
td[testTopic] = sarama.TopicDetail{
ReplicationFactor: testReplicationFactor,
ConfigEntries: map[string]*string{
minInsyncRelicas: &strMinInsyncReplicas,
retentionMs: &strLogRetentionMs,
retentionBytes: &strLogRetentionBytes,
minInsyncReplicas: &strMinInsyncReplicas,
retentionMs: &strLogRetentionMs,
retentionBytes: &strLogRetentionBytes,
},
}
clusterAdmin.topics = td
Expand Down
Loading