From 778d8f755f8316cb6f66a6ea542d607bc2431372 Mon Sep 17 00:00:00 2001 From: Nicolas <69248573+niwoerner@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:43:45 +0100 Subject: [PATCH] [receiver/gitlab] add tracing via webhook skeleton (#36838) #### Description This PR adds the structure and trace skeleton for a new and already accepted Gitlabreceiver. (thanks @atoulme for sponsoring this!) The Gitlabreceiver aligns very closely with the Githubreceiver and this PR mostly mirrors the change from this PR: https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/36632 I'm working together with @adrielp on building out the Gitlabreceiver. More PRs to introduce metrics and actual tracing functionality are about to follow with subsequent PRs. #### Link to tracking issue https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35207 #### Testing Added basic tests and built the component to test that the health check endpoint, when tracing is enabled, operates correctly. #### Documentation Docs how to configure the Gitlabreceiver via webhooks have been added. While the Gitlabreceiver can be configured after this PR, it will not actually do anything since it is under development and just the skeleton PR. --- .chloggen/gl-receiver-skeleton-traces.yaml | 30 ++ .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/bug_report.yaml | 1 + .github/ISSUE_TEMPLATE/feature_request.yaml | 1 + .github/ISSUE_TEMPLATE/other.yaml | 1 + .github/ISSUE_TEMPLATE/unmaintained.yaml | 1 + receiver/gitlabreceiver/Makefile | 1 + receiver/gitlabreceiver/README.md | 55 +++ receiver/gitlabreceiver/config.go | 136 ++++++++ receiver/gitlabreceiver/config_test.go | 123 +++++++ receiver/gitlabreceiver/doc.go | 6 + receiver/gitlabreceiver/factory.go | 31 ++ receiver/gitlabreceiver/factory_test.go | 23 ++ .../generated_component_test.go | 69 ++++ .../gitlabreceiver/generated_package_test.go | 13 + receiver/gitlabreceiver/go.mod | 138 ++++++++ receiver/gitlabreceiver/go.sum | 321 ++++++++++++++++++ .../internal/metadata/generated_status.go | 16 + receiver/gitlabreceiver/metadata.yaml | 13 + receiver/gitlabreceiver/testdata/config.yaml | 36 ++ receiver/gitlabreceiver/traces_receiver.go | 114 +++++++ .../gitlabreceiver/traces_receiver_test.go | 36 ++ versions.yaml | 1 + 23 files changed, 1167 insertions(+) create mode 100644 .chloggen/gl-receiver-skeleton-traces.yaml create mode 100644 receiver/gitlabreceiver/Makefile create mode 100644 receiver/gitlabreceiver/README.md create mode 100644 receiver/gitlabreceiver/config.go create mode 100644 receiver/gitlabreceiver/config_test.go create mode 100644 receiver/gitlabreceiver/doc.go create mode 100644 receiver/gitlabreceiver/factory.go create mode 100644 receiver/gitlabreceiver/factory_test.go create mode 100644 receiver/gitlabreceiver/generated_component_test.go create mode 100644 receiver/gitlabreceiver/generated_package_test.go create mode 100644 receiver/gitlabreceiver/go.mod create mode 100644 receiver/gitlabreceiver/go.sum create mode 100644 receiver/gitlabreceiver/internal/metadata/generated_status.go create mode 100644 receiver/gitlabreceiver/metadata.yaml create mode 100644 receiver/gitlabreceiver/testdata/config.yaml create mode 100644 receiver/gitlabreceiver/traces_receiver.go create mode 100644 receiver/gitlabreceiver/traces_receiver_test.go diff --git a/.chloggen/gl-receiver-skeleton-traces.yaml b/.chloggen/gl-receiver-skeleton-traces.yaml new file mode 100644 index 000000000000..d5d4e0fb339c --- /dev/null +++ b/.chloggen/gl-receiver-skeleton-traces.yaml @@ -0,0 +1,30 @@ +# 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: gitlabreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Adds webhook skeleton to GitLab receiver to receive events from GitLab for tracing. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35207] + +# (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: + This PR adds a skeleton for the GitLab receiver to receive events from GitLab + for tracing via a webhook. The trace portion of this receiver will run and + respond to GET requests for the health check only. + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e1010b465647..9956b99e4795 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -226,6 +226,7 @@ receiver/filestatsreceiver/ @open-telemetry/collector-cont receiver/flinkmetricsreceiver/ @open-telemetry/collector-contrib-approvers @JonathanWamsley receiver/fluentforwardreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax receiver/githubreceiver/ @open-telemetry/collector-contrib-approvers @adrielp @andrzej-stencel @crobert-1 @TylerHelmuth +receiver/gitlabreceiver/ @open-telemetry/collector-contrib-approvers @adrielp @atoulme receiver/googlecloudmonitoringreceiver/ @open-telemetry/collector-contrib-approvers @dashpole @TylerHelmuth @abhishek-at-cloudwerx receiver/googlecloudpubsubreceiver/ @open-telemetry/collector-contrib-approvers @alexvanboxel receiver/googlecloudspannerreceiver/ @open-telemetry/collector-contrib-approvers @dashpole @dsimil @KiranmayiB @harishbohara11 diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index ea469c572bcb..e3a425d12b06 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -223,6 +223,7 @@ body: - receiver/flinkmetrics - receiver/fluentforward - receiver/github + - receiver/gitlab - receiver/googlecloudmonitoring - receiver/googlecloudpubsub - receiver/googlecloudspanner diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 99f72f1c13b1..6bd5fcdd0bc7 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -217,6 +217,7 @@ body: - receiver/flinkmetrics - receiver/fluentforward - receiver/github + - receiver/gitlab - receiver/googlecloudmonitoring - receiver/googlecloudpubsub - receiver/googlecloudspanner diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index c65b1b3fa089..03bc39c5ed22 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -217,6 +217,7 @@ body: - receiver/flinkmetrics - receiver/fluentforward - receiver/github + - receiver/gitlab - receiver/googlecloudmonitoring - receiver/googlecloudpubsub - receiver/googlecloudspanner diff --git a/.github/ISSUE_TEMPLATE/unmaintained.yaml b/.github/ISSUE_TEMPLATE/unmaintained.yaml index a6402ed0e246..ef0678ebdbcd 100644 --- a/.github/ISSUE_TEMPLATE/unmaintained.yaml +++ b/.github/ISSUE_TEMPLATE/unmaintained.yaml @@ -222,6 +222,7 @@ body: - receiver/flinkmetrics - receiver/fluentforward - receiver/github + - receiver/gitlab - receiver/googlecloudmonitoring - receiver/googlecloudpubsub - receiver/googlecloudspanner diff --git a/receiver/gitlabreceiver/Makefile b/receiver/gitlabreceiver/Makefile new file mode 100644 index 000000000000..ded7a36092dc --- /dev/null +++ b/receiver/gitlabreceiver/Makefile @@ -0,0 +1 @@ +include ../../Makefile.Common diff --git a/receiver/gitlabreceiver/README.md b/receiver/gitlabreceiver/README.md new file mode 100644 index 000000000000..bd0464f9d79c --- /dev/null +++ b/receiver/gitlabreceiver/README.md @@ -0,0 +1,55 @@ +# GitLab Receiver + + +| Status | | +| ------------- |-----------| +| Stability | [development]: traces | +| Distributions | [] | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fgitlab%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fgitlab) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fgitlab%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fgitlab) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@adrielp](https://www.github.com/adrielp), [@atoulme](https://www.github.com/atoulme) | + +[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development + + +## Traces - Getting Started + +Workflow tracing support is actively being added to the GitLab receiver. +This is accomplished through the processing of GitLab webhook +events for pipelines. The [`pipeline`](https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#pipeline-events) event payloads are then constructed into `trace` +telemetry. + +Each GitLab pipeline, along with its jobs, is converted +into trace spans, allowing the observation of workflow execution times, +success, and failure rates. + +### Configuration + +**IMPORTANT: At this time the tracing portion of this receiver only serves a health check endpoint.** + +The WebHook configuration exposes the following settings: + +* `endpoint`: (default = `localhost:8080`) - The address and port to bind the WebHook to. +* `path`: (default = `/events`) - The path for Action events to be sent to. +* `health_path`: (default = `/health`) - The path for health checks. +* `secret`: (optional) - The secret used to [validate the payload](https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#custom-headers). +* `required_headers`: (optional) - One or more key-value pairs representing required headers for incoming requests. These headers must not conflict with the fixed default GitLab headers. See the customizable and fixed GitLab headers in [config.go](./config.go). + +The WebHook configuration block also accepts all the [confighttp](https://pkg.go.dev/go.opentelemetry.io/collector/config/confighttp#ServerConfig) +settings. + +An example configuration is as follows: + +```yaml +receivers: + gitlab: + webhook: + endpoint: localhost:19418 + path: /events + health_path: /health + secret: ${env:SECRET_STRING_VAR} + required_headers: + WAF-Header: "value" +``` + +For tracing, all configuration is set under the `webhook` key. The full set +of exposed configuration values can be found in [`config.go`](config.go). diff --git a/receiver/gitlabreceiver/config.go b/receiver/gitlabreceiver/config.go new file mode 100644 index 000000000000..bf753f6c0608 --- /dev/null +++ b/receiver/gitlabreceiver/config.go @@ -0,0 +1,136 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package gitlabreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitlabreceiver" + +import ( + "errors" + "time" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/config/configopaque" + "go.opentelemetry.io/collector/confmap" + "go.uber.org/multierr" +) + +const ( + defaultReadTimeout = 500 * time.Millisecond + defaultWriteTimeout = 500 * time.Millisecond + + defaultEndpoint = "localhost:8080" + + defaultPath = "/events" + defaultHealthPath = "/health" + + // GitLab default headers: https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#delivery-headers + defaultUserAgentHeader = "User-Agent" + defaultGitlabInstanceHeader = "X-Gitlab-Instance" + defaultGitlabWebhookUUIDHeader = "X-Gitlab-Webhook-UUID" + defaultGitlabEventHeader = "X-Gitlab-Event" + defaultGitlabEventUUIDHeader = "X-Gitlab-Event-UUID" + defaultIdempotencyKeyHeader = "Idempotency-Key" +) + +var ( + errReadTimeoutExceedsMaxValue = errors.New("the duration specified for read_timeout exceeds the maximum allowed value of 10s") + errWriteTimeoutExceedsMaxValue = errors.New("the duration specified for write_timeout exceeds the maximum allowed value of 10s") + errRequiredHeader = errors.New("both key and value are required to assign a required_header") + errGitlabHeader = errors.New("gitlab default headers [X-Gitlab-Webhook-UUID, X-Gitlab-Event, X-Gitlab-Event-UUID, Idempotency-Key] cannot be configured") + errConfigNotValid = errors.New("configuration is not valid for the gitlab receiver") +) + +// Config that is exposed to this gitlab receiver through the OTEL config.yaml +type Config struct { + WebHook WebHook `mapstructure:"webhook"` +} + +type WebHook struct { + confighttp.ServerConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct + + Path string `mapstructure:"path"` // path for data collection. default is /events + HealthPath string `mapstructure:"health_path"` // path for health check api. default is /health_check + + RequiredHeaders map[string]configopaque.String `mapstructure:"required_headers"` // optional setting to set one or more required headers for all requests to have (except the health check) + GitlabHeaders GitlabHeaders `mapstructure:",squash"` // GitLab headers set by default + + Secret string `mapstructure:"secret"` // secret for webhook +} + +type GitlabHeaders struct { + Customizable map[string]string `mapstructure:","` // can be overwritten via required_headers + Fixed map[string]string `mapstructure:","` // are not allowed to be overwritten +} + +func createDefaultConfig() component.Config { + return &Config{ + WebHook: WebHook{ + ServerConfig: confighttp.ServerConfig{ + Endpoint: defaultEndpoint, + ReadTimeout: defaultReadTimeout, + WriteTimeout: defaultWriteTimeout, + }, + GitlabHeaders: GitlabHeaders{ + Customizable: map[string]string{ + defaultUserAgentHeader: "", + defaultGitlabInstanceHeader: "https://gitlab.com", + }, + Fixed: map[string]string{ + defaultGitlabWebhookUUIDHeader: "", + defaultGitlabEventHeader: "Pipeline Hook", + defaultGitlabEventUUIDHeader: "", + defaultIdempotencyKeyHeader: "", + }, + }, + Path: defaultPath, + HealthPath: defaultHealthPath, + }, + } +} + +func (cfg *Config) Validate() error { + var errs error + + maxReadWriteTimeout, _ := time.ParseDuration("10s") + + if cfg.WebHook.ServerConfig.ReadTimeout > maxReadWriteTimeout { + errs = multierr.Append(errs, errReadTimeoutExceedsMaxValue) + } + + if cfg.WebHook.ServerConfig.WriteTimeout > maxReadWriteTimeout { + errs = multierr.Append(errs, errWriteTimeoutExceedsMaxValue) + } + + for key, value := range cfg.WebHook.RequiredHeaders { + if key == "" || value == "" { + errs = multierr.Append(errs, errRequiredHeader) + } + + if _, exists := cfg.WebHook.GitlabHeaders.Fixed[key]; exists { + errs = multierr.Append(errs, errGitlabHeader) + } + } + + return errs +} + +func (cfg *Config) Unmarshal(componentParser *confmap.Conf) error { + if componentParser == nil { + return nil + } + + // load the non-dynamic config normally + err := componentParser.Unmarshal(cfg, confmap.WithIgnoreUnused()) + if err != nil { + return err + } + + // overwrite customizable GitLab default headers if configured within the required_headers + for key, header := range cfg.WebHook.RequiredHeaders { + if _, exists := cfg.WebHook.GitlabHeaders.Customizable[key]; exists { + cfg.WebHook.GitlabHeaders.Customizable[key] = string(header) + } + } + + return nil +} diff --git a/receiver/gitlabreceiver/config_test.go b/receiver/gitlabreceiver/config_test.go new file mode 100644 index 000000000000..54d0dbc2d936 --- /dev/null +++ b/receiver/gitlabreceiver/config_test.go @@ -0,0 +1,123 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package gitlabreceiver + +import ( + "path/filepath" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/config/configopaque" + "go.opentelemetry.io/collector/otelcol/otelcoltest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitlabreceiver/internal/metadata" +) + +func TestCreateDefaultConfig(t *testing.T) { + factory := NewFactory() + cfg := factory.CreateDefaultConfig() + + expectedConfig := &Config{ + WebHook: WebHook{ + ServerConfig: confighttp.ServerConfig{ + Endpoint: defaultEndpoint, + ReadTimeout: defaultReadTimeout, + WriteTimeout: defaultWriteTimeout, + }, + Path: defaultPath, + HealthPath: defaultHealthPath, + GitlabHeaders: GitlabHeaders{ + Customizable: map[string]string{ + defaultUserAgentHeader: "", + defaultGitlabInstanceHeader: "https://gitlab.com", + }, + Fixed: map[string]string{ + defaultGitlabWebhookUUIDHeader: "", + defaultGitlabEventHeader: "Pipeline Hook", + defaultGitlabEventUUIDHeader: "", + defaultIdempotencyKeyHeader: "", + }, + }, + }, + } + + assert.Equal(t, expectedConfig, cfg, "failed to create default config") + assert.NoError(t, componenttest.CheckConfigStruct(cfg)) +} + +func TestLoadConfig(t *testing.T) { + factories, err := otelcoltest.NopFactories() + require.NoError(t, err) + + factory := NewFactory() + factories.Receivers[metadata.Type] = factory + + cfg, err := otelcoltest.LoadConfigAndValidate(filepath.Join("testdata", "config.yaml"), factories) + + require.NoError(t, err) + require.NotNil(t, cfg) + + assert.Len(t, cfg.Receivers, 2) + + expectedConfig := &Config{ + WebHook: WebHook{ + ServerConfig: confighttp.ServerConfig{ + Endpoint: "localhost:8080", + ReadTimeout: 500 * time.Millisecond, + WriteTimeout: 500 * time.Millisecond, + }, + Path: "some/path", + HealthPath: "health/path", + RequiredHeaders: map[string]configopaque.String{ + "key1-present": "value1-present", + }, + GitlabHeaders: GitlabHeaders{ + Customizable: map[string]string{ + defaultUserAgentHeader: "", + defaultGitlabInstanceHeader: "https://gitlab.com", + }, + Fixed: map[string]string{ + defaultGitlabWebhookUUIDHeader: "", + defaultGitlabEventHeader: "Pipeline Hook", + defaultGitlabEventUUIDHeader: "", + defaultIdempotencyKeyHeader: "", + }, + }, + }, + } + + r0 := cfg.Receivers[component.NewID(metadata.Type)] + + assert.Equal(t, expectedConfig, r0) + + // r1 requires multiple headers and overwrites gitlab default headers + expectedConfig.WebHook.RequiredHeaders = map[string]configopaque.String{ + "key1-present": "value1-present", + "key2-present": "value2-present", + "User-Agent": "GitLab/1.2.3-custom-version", + "X-Gitlab-Instance": "https://gitlab.self-hosted.xyz", + } + + expectedConfig.WebHook.GitlabHeaders = GitlabHeaders{ + Customizable: map[string]string{ + defaultUserAgentHeader: "GitLab/1.2.3-custom-version", + defaultGitlabInstanceHeader: "https://gitlab.self-hosted.xyz", + }, + Fixed: map[string]string{ + defaultGitlabWebhookUUIDHeader: "", + defaultGitlabEventHeader: "Pipeline Hook", + defaultGitlabEventUUIDHeader: "", + defaultIdempotencyKeyHeader: "", + }, + } + + r1 := cfg.Receivers[component.NewIDWithName(metadata.Type, "customname")].(*Config) + + assert.Equal(t, expectedConfig, r1) +} diff --git a/receiver/gitlabreceiver/doc.go b/receiver/gitlabreceiver/doc.go new file mode 100644 index 000000000000..346240ef41dc --- /dev/null +++ b/receiver/gitlabreceiver/doc.go @@ -0,0 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mdatagen metadata.yaml + +package gitlabreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitlabreceiver" diff --git a/receiver/gitlabreceiver/factory.go b/receiver/gitlabreceiver/factory.go new file mode 100644 index 000000000000..dbcd3b23334f --- /dev/null +++ b/receiver/gitlabreceiver/factory.go @@ -0,0 +1,31 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package gitlabreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitlabreceiver" + +import ( + "context" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/receiver" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitlabreceiver/internal/metadata" +) + +func createTracesReceiver(_ context.Context, params receiver.Settings, cfg component.Config, consumer consumer.Traces) (receiver.Traces, error) { + // check that the configuration is valid + conf, ok := cfg.(*Config) + if !ok { + return nil, errConfigNotValid + } + + return newTracesReceiver(params, conf, consumer) +} + +func NewFactory() receiver.Factory { + return receiver.NewFactory( + metadata.Type, + createDefaultConfig, + receiver.WithTraces(createTracesReceiver, component.StabilityLevelDevelopment)) +} diff --git a/receiver/gitlabreceiver/factory_test.go b/receiver/gitlabreceiver/factory_test.go new file mode 100644 index 000000000000..5ae5a73fe031 --- /dev/null +++ b/receiver/gitlabreceiver/factory_test.go @@ -0,0 +1,23 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package gitlabreceiver + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver/receivertest" +) + +func TestCreateTracesReceiver(t *testing.T) { + factory := NewFactory() + cfg := factory.CreateDefaultConfig() + assert.NotNil(t, cfg, "failed to create default config") + + tReceiver, err := factory.CreateTraces(context.Background(), receivertest.NewNopSettings(), cfg, consumertest.NewNop()) + assert.NoError(t, err) + assert.NotNil(t, tReceiver, "traces receiver creation failed") +} diff --git a/receiver/gitlabreceiver/generated_component_test.go b/receiver/gitlabreceiver/generated_component_test.go new file mode 100644 index 000000000000..ca3c0b56f562 --- /dev/null +++ b/receiver/gitlabreceiver/generated_component_test.go @@ -0,0 +1,69 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package gitlabreceiver + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/receivertest" +) + +func TestComponentFactoryType(t *testing.T) { + require.Equal(t, "gitlab", NewFactory().Type().String()) +} + +func TestComponentConfigStruct(t *testing.T) { + require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig())) +} + +func TestComponentLifecycle(t *testing.T) { + factory := NewFactory() + + tests := []struct { + name string + createFn func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) + }{ + + { + name: "traces", + createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) { + return factory.CreateTraces(ctx, set, cfg, consumertest.NewNop()) + }, + }, + } + + cm, err := confmaptest.LoadConf("metadata.yaml") + require.NoError(t, err) + cfg := factory.CreateDefaultConfig() + sub, err := cm.Sub("tests::config") + require.NoError(t, err) + require.NoError(t, sub.Unmarshal(&cfg)) + + for _, tt := range tests { + t.Run(tt.name+"-shutdown", func(t *testing.T) { + c, err := tt.createFn(context.Background(), receivertest.NewNopSettings(), cfg) + require.NoError(t, err) + err = c.Shutdown(context.Background()) + require.NoError(t, err) + }) + t.Run(tt.name+"-lifecycle", func(t *testing.T) { + firstRcvr, err := tt.createFn(context.Background(), receivertest.NewNopSettings(), cfg) + require.NoError(t, err) + host := componenttest.NewNopHost() + require.NoError(t, err) + require.NoError(t, firstRcvr.Start(context.Background(), host)) + require.NoError(t, firstRcvr.Shutdown(context.Background())) + secondRcvr, err := tt.createFn(context.Background(), receivertest.NewNopSettings(), cfg) + require.NoError(t, err) + require.NoError(t, secondRcvr.Start(context.Background(), host)) + require.NoError(t, secondRcvr.Shutdown(context.Background())) + }) + } +} diff --git a/receiver/gitlabreceiver/generated_package_test.go b/receiver/gitlabreceiver/generated_package_test.go new file mode 100644 index 000000000000..7224acad01dc --- /dev/null +++ b/receiver/gitlabreceiver/generated_package_test.go @@ -0,0 +1,13 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package gitlabreceiver + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/receiver/gitlabreceiver/go.mod b/receiver/gitlabreceiver/go.mod new file mode 100644 index 000000000000..d56db37efedb --- /dev/null +++ b/receiver/gitlabreceiver/go.mod @@ -0,0 +1,138 @@ +module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitlabreceiver + +go 1.22.8 + +require ( + github.com/stretchr/testify v1.10.0 + go.opentelemetry.io/collector/component v0.117.0 + go.opentelemetry.io/collector/component/componenttest v0.117.0 + go.opentelemetry.io/collector/config/confighttp v0.117.0 + go.opentelemetry.io/collector/confmap v1.23.0 + go.opentelemetry.io/collector/consumer v1.23.0 + go.opentelemetry.io/collector/consumer/consumertest v0.117.0 + go.opentelemetry.io/collector/receiver v0.117.0 + go.opentelemetry.io/collector/receiver/receivertest v0.117.0 + go.uber.org/goleak v1.3.0 +) + +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/ebitengine/purego v0.8.1 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/prometheus/client_golang v1.20.5 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.61.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect + github.com/shirou/gopsutil/v4 v4.24.12 // indirect + github.com/spf13/cobra v1.8.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/collector/confmap/provider/envprovider v1.23.0 // indirect + go.opentelemetry.io/collector/confmap/provider/fileprovider v1.23.0 // indirect + go.opentelemetry.io/collector/confmap/provider/httpprovider v1.23.0 // indirect + go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.23.0 // indirect + go.opentelemetry.io/collector/connector v0.117.0 // indirect + go.opentelemetry.io/collector/connector/connectortest v0.117.0 // indirect + go.opentelemetry.io/collector/connector/xconnector v0.117.0 // indirect + go.opentelemetry.io/collector/consumer/xconsumer v0.117.0 // indirect + go.opentelemetry.io/collector/exporter v0.117.0 // indirect + go.opentelemetry.io/collector/exporter/exportertest v0.117.0 // indirect + go.opentelemetry.io/collector/exporter/xexporter v0.117.0 // indirect + go.opentelemetry.io/collector/extension/extensioncapabilities v0.117.0 // indirect + go.opentelemetry.io/collector/extension/extensiontest v0.117.0 // indirect + go.opentelemetry.io/collector/featuregate v1.23.0 // indirect + go.opentelemetry.io/collector/internal/fanoutconsumer v0.117.0 // indirect + go.opentelemetry.io/collector/otelcol v0.117.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.117.0 // indirect + go.opentelemetry.io/collector/pipeline/xpipeline v0.117.0 // indirect + go.opentelemetry.io/collector/processor v0.117.0 // indirect + go.opentelemetry.io/collector/processor/processortest v0.117.0 // indirect + go.opentelemetry.io/collector/processor/xprocessor v0.117.0 // indirect + go.opentelemetry.io/collector/receiver/xreceiver v0.117.0 // indirect + go.opentelemetry.io/collector/semconv v0.117.0 // indirect + go.opentelemetry.io/collector/service v0.117.0 // indirect + go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 // indirect + go.opentelemetry.io/contrib/config v0.10.0 // indirect + go.opentelemetry.io/contrib/propagators/b3 v1.31.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect + go.opentelemetry.io/otel/exporters/prometheus v0.54.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 // indirect + go.opentelemetry.io/otel/log v0.8.0 // indirect + go.opentelemetry.io/otel/sdk/log v0.7.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect + gonum.org/v1/gonum v0.15.1 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/fsnotify/fsnotify v1.8.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/gorilla/mux v1.8.1 + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.11 // indirect + github.com/knadh/koanf/maps v0.1.1 // indirect + github.com/knadh/koanf/providers/confmap v0.1.0 // indirect + github.com/knadh/koanf/v2 v2.1.2 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pierrec/lz4/v4 v4.1.22 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rs/cors v1.11.1 // indirect + go.opentelemetry.io/collector/client v1.23.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.117.0 + go.opentelemetry.io/collector/config/configauth v0.117.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.23.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.23.0 + go.opentelemetry.io/collector/config/configtelemetry v0.117.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.23.0 // indirect + go.opentelemetry.io/collector/consumer/consumererror v0.117.0 // indirect + go.opentelemetry.io/collector/extension v0.117.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.117.0 // indirect + go.opentelemetry.io/collector/otelcol/otelcoltest v0.117.0 + go.opentelemetry.io/collector/pdata v1.23.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.117.0 // indirect + go.opentelemetry.io/collector/pipeline v0.117.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect + go.opentelemetry.io/otel v1.33.0 // indirect + go.opentelemetry.io/otel/metric v1.33.0 // indirect + go.opentelemetry.io/otel/sdk v1.32.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect + go.opentelemetry.io/otel/trace v1.33.0 // indirect + go.uber.org/multierr v1.11.0 + go.uber.org/zap v1.27.0 + golang.org/x/net v0.34.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422 // indirect + google.golang.org/grpc v1.69.2 // indirect + google.golang.org/protobuf v1.36.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/receiver/gitlabreceiver/go.sum b/receiver/gitlabreceiver/go.sum new file mode 100644 index 000000000000..81527f4c3675 --- /dev/null +++ b/receiver/gitlabreceiver/go.sum @@ -0,0 +1,321 @@ +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE= +github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 h1:ad0vkEBuk23VJzZR9nkLVG0YAoN9coASF1GusYX6AlU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0/go.mod h1:igFoXX2ELCW06bol23DWPB5BEWfZISOzSP5K2sbLea0= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= +github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= +github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= +github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU= +github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= +github.com/knadh/koanf/v2 v2.1.2 h1:I2rtLRqXRy1p01m/utEtpZSSA6dcJbgGVuE27kW2PzQ= +github.com/knadh/koanf/v2 v2.1.2/go.mod h1:Gphfaen0q1Fc1HTgJgSTC4oRX9R2R5ErYMZJy8fLJBo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU= +github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFSRQQ= +github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shirou/gopsutil/v4 v4.24.12 h1:qvePBOk20e0IKA1QXrIIU+jmk+zEiYVVx06WjBRlZo4= +github.com/shirou/gopsutil/v4 v4.24.12/go.mod h1:DCtMPAad2XceTeIAbGyVfycbYQNBGk2P8cvDi7/VN9o= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/collector v0.117.0 h1:nj/Q89KGmev1l4YxWJt4JH3+fV1YFmci9MRmr9bULf4= +go.opentelemetry.io/collector v0.117.0/go.mod h1:z8XawVuKONaUkJW5w1GrfAXokrgxdF8mGtekK0sFIyQ= +go.opentelemetry.io/collector/client v1.23.0 h1:X11yEZ2T3T1Cr1CfDPI0xjZgw7ekes7CVbF/NVYxGG0= +go.opentelemetry.io/collector/client v1.23.0/go.mod h1:pfhOGJ13n5xH3HgmFwUHa1nBE1kCIa9X/DLTJVxtbVM= +go.opentelemetry.io/collector/component v0.117.0 h1:A3Im4PqLyfduAdVyUgbOZdUs7J/USegdpnkoIAOuN3Y= +go.opentelemetry.io/collector/component v0.117.0/go.mod h1:+SxJgeMwNV6y3aKNR2sP0PfovcUlRwC0+pEv4tTYdXA= +go.opentelemetry.io/collector/component/componentstatus v0.117.0 h1:8PGN66p9o5L7xCfT4jDJHd3d2VdtIuzPU2mEXOSONt8= +go.opentelemetry.io/collector/component/componentstatus v0.117.0/go.mod h1:u8tVDI+S9TxBa5NtxJNdxqjI0CLIzbmqbRl9DPrdR/0= +go.opentelemetry.io/collector/component/componenttest v0.117.0 h1:r3k0BsU/cJlqVQRtgFjxfduNEGaM2qCAU7JitIGkRds= +go.opentelemetry.io/collector/component/componenttest v0.117.0/go.mod h1:MoBWSGb3KwGc5FAIO+htez/QWK2uqJ4fnbEnfHB384c= +go.opentelemetry.io/collector/config/configauth v0.117.0 h1:o+sEz1aeS01XD3procwMmvDAhGHFFH1dxmC6XHwxG6s= +go.opentelemetry.io/collector/config/configauth v0.117.0/go.mod h1:oWkIayfVGS/ED6jEDTILSypW8MVNZ/bHd11lXrt7fsQ= +go.opentelemetry.io/collector/config/configcompression v1.23.0 h1:KCEztOb+2L4+dUCCadOW/byRiw7LbgguNqHD5LxJcwY= +go.opentelemetry.io/collector/config/configcompression v1.23.0/go.mod h1:LvYG00tbPTv0NOLoZN0wXq1F5thcxvukO8INq7xyfWU= +go.opentelemetry.io/collector/config/confighttp v0.117.0 h1:0BRGo1aivqIsGtAMmxTZ0u3rlGJ073+iyHD5RvUOtQk= +go.opentelemetry.io/collector/config/confighttp v0.117.0/go.mod h1:iNCp62v5k9SPTOdOxQlPfs/4gLGh7YLGpjP//9uvT0A= +go.opentelemetry.io/collector/config/configopaque v1.23.0 h1:SEnEzOHufGc4KGOjQq8zKIQuDBmRFl9ncZ3qs1SRpJk= +go.opentelemetry.io/collector/config/configopaque v1.23.0/go.mod h1:sW0t0iI/VfRL9VYX7Ik6XzVgPcR+Y5kejTLsYcMyDWs= +go.opentelemetry.io/collector/config/configretry v1.23.0 h1:0Ox2KvTZyNdgureAs3kJzsNIa6ttrx9bwlKjj/p4fGU= +go.opentelemetry.io/collector/config/configretry v1.23.0/go.mod h1:cleBc9I0DIWpTiiHfu9v83FUaCTqcPXmebpLxjEIqro= +go.opentelemetry.io/collector/config/configtelemetry v0.117.0 h1:xsMfc89VByIF2fJzWuxs/2eqy44DWfNBAysReG4TAr8= +go.opentelemetry.io/collector/config/configtelemetry v0.117.0/go.mod h1:SlBEwQg0qly75rXZ6W1Ig8jN25KBVBkFIIAUI1GiAAE= +go.opentelemetry.io/collector/config/configtls v1.23.0 h1:52q9dAV923hHn1aoYQyKGnrRXCPvTTT3DXurtxcpZaQ= +go.opentelemetry.io/collector/config/configtls v1.23.0/go.mod h1:cjMoqKm4MX9sc9qyEW5/kRepiKLuDYqFofGa0f/rqFE= +go.opentelemetry.io/collector/confmap v1.23.0 h1:EY+auc0kbyZ4HIfkLYeJyLDCZIFzMA1u8QRGW4bC1Ag= +go.opentelemetry.io/collector/confmap v1.23.0/go.mod h1:Rrhs+MWoaP6AswZp+ReQ2VO9dfOfcUjdjiSHBsG+nec= +go.opentelemetry.io/collector/confmap/provider/envprovider v1.23.0 h1:b1aZxceRYYH1wXqqVHYZpepiVKYy8WJ27NHq/KQFQJs= +go.opentelemetry.io/collector/confmap/provider/envprovider v1.23.0/go.mod h1:c1zdel/NZJumOWY8RhKfOuF/uxihNxQrJzBQcnY0HFw= +go.opentelemetry.io/collector/confmap/provider/fileprovider v1.23.0 h1:2CwU9PZLCP76iNTk6vP1CN3BA1C9OnnebpCE0WQf6F4= +go.opentelemetry.io/collector/confmap/provider/fileprovider v1.23.0/go.mod h1:tDUen3bEdWlgJtJEc2OrNV6sTfR/QkImyAFlxUXcplY= +go.opentelemetry.io/collector/confmap/provider/httpprovider v1.23.0 h1:CdGl8CI5rnbAhNIJwisCKvKEiqOKWTZqnsQ2WqcCPs8= +go.opentelemetry.io/collector/confmap/provider/httpprovider v1.23.0/go.mod h1:lvljQaUjATZhFghYNPGNjIO3lsedzv7lOlkQfOdiung= +go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.23.0 h1:ZaK8+EcQxlYZZgJn7ew700AUhH9CpXA3VBn46OHHEHk= +go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.23.0/go.mod h1:WrlXU+lshUTmsgyacD7jijs0Nh85Xf0xU/0sqtkHDNs= +go.opentelemetry.io/collector/connector v0.117.0 h1:7MM6FOrquYyLSftp3vJSeahRLcVcJ+EwgsqZpsPtGas= +go.opentelemetry.io/collector/connector v0.117.0/go.mod h1:Qp3KAr/S3vMjOtWG5tZxQ+6JgFFYBUzFx6xzM6Xt30A= +go.opentelemetry.io/collector/connector/connectortest v0.117.0 h1:tRes8VpoYEXbOZtT5NQdYhWd7PyHy4N3R/9M2VMZt7U= +go.opentelemetry.io/collector/connector/connectortest v0.117.0/go.mod h1:rb7ax+hQzL2fiUFI9QpfOPQX2S6GfJlyxjT4tsIYODQ= +go.opentelemetry.io/collector/connector/xconnector v0.117.0 h1:H4tTVBKDW9bfEJ+6p6ZDIdN7yUkGl59ELs0+46UtQ78= +go.opentelemetry.io/collector/connector/xconnector v0.117.0/go.mod h1:aAfKBBFnJrPgKC653Lt1gwfTDbSZUuTY4TPI7Fcv9MM= +go.opentelemetry.io/collector/consumer v1.23.0 h1:JT0nE1vikL5yIk97IHBGzwx8co3w1WsAd3GFEl8r9XA= +go.opentelemetry.io/collector/consumer v1.23.0/go.mod h1:8d0uQ6gq64LbPktV4sc888lRj1cQCmrdl13hRIEURgA= +go.opentelemetry.io/collector/consumer/consumererror v0.117.0 h1:PPIZCcYZcENnyIrpRV4ERvMUoPSTV0zIP0QPzJvz80g= +go.opentelemetry.io/collector/consumer/consumererror v0.117.0/go.mod h1:L47xOVC+Vzos8350j3SWtU43w7rzms6UDhb6IrFxymY= +go.opentelemetry.io/collector/consumer/consumertest v0.117.0 h1:9WFyyjLudvfJDEuUaGsQyNRd1m6D1iRg8Iyg3xliFko= +go.opentelemetry.io/collector/consumer/consumertest v0.117.0/go.mod h1:B7A+OS76QKAzM8W7cmvlfVynFELj9Sa444hSm1SILFw= +go.opentelemetry.io/collector/consumer/xconsumer v0.117.0 h1:vsBNJGaEbYqgMU3PEsOcqjMxX5ul++Cxda44sttoi8c= +go.opentelemetry.io/collector/consumer/xconsumer v0.117.0/go.mod h1:dTr+Tms53lRLvR3OAzYic0yhcwldhTUdVIwJNSDmBmw= +go.opentelemetry.io/collector/exporter v0.117.0 h1:A9kVXzdb8i1eFELImuaSPyijAfg4qMIpM/4y/98mlxk= +go.opentelemetry.io/collector/exporter v0.117.0/go.mod h1:Cbrorch2s18w1X7+A+zXQtAffbInnIOP7Su26gbRG+k= +go.opentelemetry.io/collector/exporter/exportertest v0.117.0 h1:u+loeqxpniMiJL1iqc/lCCcfniWrqHBgJTAjXfqVBqQ= +go.opentelemetry.io/collector/exporter/exportertest v0.117.0/go.mod h1:GyHwJLsOPPau0m+TYrIA7jWD9/GU+ID+l/9sL0cAqhE= +go.opentelemetry.io/collector/exporter/xexporter v0.117.0 h1:BB8D0Dvb46CVAZrnPEg5nYgXO7LzONmXeGKEfzSIOZs= +go.opentelemetry.io/collector/exporter/xexporter v0.117.0/go.mod h1:yo0T8WkvLCJ7NOqIquHGFe4Xpuc4CbDb8a06T2G5De4= +go.opentelemetry.io/collector/extension v0.117.0 h1:B3cG7g+wbhmpMFugaDxOcyiPKeulaW8+EQdJbZxDfho= +go.opentelemetry.io/collector/extension v0.117.0/go.mod h1:WjyD5h9N5Y0SF8azB2rulvHJieJoWqroGO5hi3ax5+8= +go.opentelemetry.io/collector/extension/auth v0.117.0 h1:tXQdYIdcABXalWyFZP22pREY7+nWUNurx8Y6FseWs7w= +go.opentelemetry.io/collector/extension/auth v0.117.0/go.mod h1:ofrV2BuE46+k7Su/h0ccrMl5Zk5Y7NVlzOb3AwU7Dzw= +go.opentelemetry.io/collector/extension/auth/authtest v0.117.0 h1:wV4OIiWrt7gteQrxL8MCmGvjGhMiu5TplKJHOfVZO6Y= +go.opentelemetry.io/collector/extension/auth/authtest v0.117.0/go.mod h1:nHxcAOyo26JnuYwKIoQM9mDlSXpERQrbjIw3Dtp9hug= +go.opentelemetry.io/collector/extension/extensioncapabilities v0.117.0 h1:YbCF0s0jywLZgwNUyKdPUMLMZs3nUPm1tGvJz8x6wTU= +go.opentelemetry.io/collector/extension/extensioncapabilities v0.117.0/go.mod h1:VArn6UKAy4pqlATfhDFfc8UOwX/TtavPF5pgAL70AEw= +go.opentelemetry.io/collector/extension/extensiontest v0.117.0 h1:XH+tkHdATylYZtASZKK3rCoN/xlaFi8MXLh07ZlQQWw= +go.opentelemetry.io/collector/extension/extensiontest v0.117.0/go.mod h1:ABqB9D41p4MCeGVmABOgJi7i7roWZlFbqeFJDy7lskQ= +go.opentelemetry.io/collector/extension/xextension v0.117.0 h1:ADUKWHGaVvvmebJHiNRuX6YAfQXFDW/UaXK9W1hCo1k= +go.opentelemetry.io/collector/extension/xextension v0.117.0/go.mod h1:BmR8xN7Ja+El4IJ9aVmtON2miudjsbq2COZ9azVXsNg= +go.opentelemetry.io/collector/extension/zpagesextension v0.117.0 h1:TNSMgnCYZ1He2ANJQDoBEQ2tuHMa97qM5cpLErNLous= +go.opentelemetry.io/collector/extension/zpagesextension v0.117.0/go.mod h1:c82ly0hN5nMEtXY9mNdS9xVToYxbUjXblnXZCoICwCc= +go.opentelemetry.io/collector/featuregate v1.23.0 h1:N033ROo85qKrsK16QzR6RV+3UWOWF7kpOO8FSnX99s0= +go.opentelemetry.io/collector/featuregate v1.23.0/go.mod h1:3GaXqflNDVwWndNGBJ1+XJFy3Fv/XrFgjMN60N3z7yg= +go.opentelemetry.io/collector/internal/fanoutconsumer v0.117.0 h1:IfObXF9WEixWA9baPt0d4GOv8XGxmlsX7oAyD9Gdq/4= +go.opentelemetry.io/collector/internal/fanoutconsumer v0.117.0/go.mod h1:n+hmwNk4CbOTmQyUo1K4CEnCGcrPd7RY3E6ljrQ2GYo= +go.opentelemetry.io/collector/otelcol v0.117.0 h1:BWmXS+Qh8ypu95w5PKz4NEcyRfX9TzoXQaqD6antji8= +go.opentelemetry.io/collector/otelcol v0.117.0/go.mod h1:jbEizqJKjZ1Q7XIbKvYc+vF2sxW5aw0LO7U8wj7wysM= +go.opentelemetry.io/collector/otelcol/otelcoltest v0.117.0 h1:uELK5WYoofV19gAq0cZrmAAcBO/SP94fheYJ/+bm49g= +go.opentelemetry.io/collector/otelcol/otelcoltest v0.117.0/go.mod h1:Xo9X7JBQVCCjkkMjkRdsuvrwM82xk67HuUge7zXm5FU= +go.opentelemetry.io/collector/pdata v1.23.0 h1:tEk0dkfB8RdSukoOMfEa8duB938gfZowdfRkrJxGDrw= +go.opentelemetry.io/collector/pdata v1.23.0/go.mod h1:I2jggpBMiO8A+7TXhzNpcJZkJtvi1cU0iVNIi+6bc+o= +go.opentelemetry.io/collector/pdata/pprofile v0.117.0 h1:AyOK+rkNGeawmLGUqF84wYks22BSGJtEV++3YSfvD1I= +go.opentelemetry.io/collector/pdata/pprofile v0.117.0/go.mod h1:eh7TLIkLrSI79/R3RL+sZsKpLS0k+83WntucPtXC5Ak= +go.opentelemetry.io/collector/pdata/testdata v0.117.0 h1:ainpacShKHaDkPK6lcvgJ0aPKYUD/E3+I0gYJZleedo= +go.opentelemetry.io/collector/pdata/testdata v0.117.0/go.mod h1:LZAymmRKHQEqJqJUSO15rej3+V1rNRyBMF5mWCKCMBY= +go.opentelemetry.io/collector/pipeline v0.117.0 h1:CSv0Dd3n9AQNQ73e7PdEkgexkSMRZliKATxkoZKUFcY= +go.opentelemetry.io/collector/pipeline v0.117.0/go.mod h1:qE3DmoB05AW0C3lmPvdxZqd/H4po84NPzd5MrqgtL74= +go.opentelemetry.io/collector/pipeline/xpipeline v0.117.0 h1:jnHQNaNfVRIdrtOPCORUy8s1cEJyxql3uv/WQ1ve1Js= +go.opentelemetry.io/collector/pipeline/xpipeline v0.117.0/go.mod h1:lNY3uQjRcb3f7CW1JQMXJcWzCJp5122LOKrKs5eito8= +go.opentelemetry.io/collector/processor v0.117.0 h1:K4WdaNC5ROIoLRGgyHmXxtw7xVpAMR4cIMQ5PVLP5cI= +go.opentelemetry.io/collector/processor v0.117.0/go.mod h1:4ewsyJD4n8GjFN+mFbxgr7uXLZYNcJEnH3wl47aDV7s= +go.opentelemetry.io/collector/processor/processortest v0.117.0 h1:c2zjsm3nQDkq9GErzhczN7psGI5Wk0eqXM5LGrX3wxg= +go.opentelemetry.io/collector/processor/processortest v0.117.0/go.mod h1:nywNHogkxp++ab3QkXpWKlv41Gkm9cAYB4PHvyoHwjs= +go.opentelemetry.io/collector/processor/xprocessor v0.117.0 h1:yGBjlY8HRb2AqYo1Q8pKJOLRbmZKrjeeTO4COiP45OU= +go.opentelemetry.io/collector/processor/xprocessor v0.117.0/go.mod h1:MnyEaS47cqol7Cph6LnYIp0g2Km4M+I1vWTwiDeuBN0= +go.opentelemetry.io/collector/receiver v0.117.0 h1:jm+b2G2IKKwGE213lB9cviKEdeATvYtNSY1kO0XdpMM= +go.opentelemetry.io/collector/receiver v0.117.0/go.mod h1:fZXigB3afp54OE+ogPcup/RPwI7j+CwZh9Mz6ObB/Cg= +go.opentelemetry.io/collector/receiver/receivertest v0.117.0 h1:aN4zOuWsiARa+RG9f89JyIrJbx5wsQ71Y0giiHsO1z8= +go.opentelemetry.io/collector/receiver/receivertest v0.117.0/go.mod h1:1wnGEowDmlO89feq1P+b4tQI2G/+iJxRrMallw7zeJE= +go.opentelemetry.io/collector/receiver/xreceiver v0.117.0 h1:HJjBj6P3/WQoYaRKZkWZHnUUCVFpBieqGKzKHcT6HUw= +go.opentelemetry.io/collector/receiver/xreceiver v0.117.0/go.mod h1:K1qMjIiAg6i3vHA+/EpM8nkhna3uIgoEellE2yuhz7A= +go.opentelemetry.io/collector/semconv v0.117.0 h1:SavOvSbHPVD/QdAnXlI/cMca+yxCNyXStY1mQzerHs4= +go.opentelemetry.io/collector/semconv v0.117.0/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= +go.opentelemetry.io/collector/service v0.117.0 h1:yx3ZwnjHcL1YAWZDK2Kxco1BSB228+RaCwgmMzXykqE= +go.opentelemetry.io/collector/service v0.117.0/go.mod h1:Mtxu9Qn/90kdRrEqRr6n7MbtnW6qF1qCIi/u2LMYrRo= +go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 h1:j8icMXyyqNf6HGuwlYhniPnVsbJIq7n+WirDu3VAJdQ= +go.opentelemetry.io/contrib/bridges/otelzap v0.6.0/go.mod h1:evIOZpl+kAlU5IsaYX2Siw+IbpacAZvXemVsgt70uvw= +go.opentelemetry.io/contrib/config v0.10.0 h1:2JknAzMaYjxrHkTnZh3eOme/Y2P5eHE2SWfhfV6Xd6c= +go.opentelemetry.io/contrib/config v0.10.0/go.mod h1:aND2M6/KfNkntI5cyvHriR/zvZgPf8j9yETdSmvpfmc= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 h1:yd02MEjBdJkG3uabWP9apV+OuWRIXGDuJEUJbOHmCFU= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0/go.mod h1:umTcuxiv1n/s/S6/c2AT/g2CQ7u5C59sHDNmfSwgz7Q= +go.opentelemetry.io/contrib/propagators/b3 v1.31.0 h1:PQPXYscmwbCp76QDvO4hMngF2j8Bx/OTV86laEl8uqo= +go.opentelemetry.io/contrib/propagators/b3 v1.31.0/go.mod h1:jbqfV8wDdqSDrAYxVpXQnpM0XFMq2FtDesblJ7blOwQ= +go.opentelemetry.io/contrib/zpages v0.56.0 h1:W7vP6s3juzL5KiHpr41zLNmsJ0QAZudYu8ay0zGAoko= +go.opentelemetry.io/contrib/zpages v0.56.0/go.mod h1:IxPRP4TYHw9jLeaEOSDIiA9zmyJNZNO6sbW55iMvSXs= +go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw= +go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 h1:mMOmtYie9Fx6TSVzw4W+NTpvoaS1JWWga37oI1a/4qQ= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0/go.mod h1:yy7nDsMMBUkD+jeekJ36ur5f3jJIrmCwUrY67VFhNpA= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.32.0 h1:j7ZSD+5yn+lo3sGV69nW04rRR0jhYnBwjuX3r0HvnK0= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.32.0/go.mod h1:WXbYJTUaZXAbYd8lbgGuvih0yuCfOFC5RJoYnoLcGz8= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.32.0 h1:t/Qur3vKSkUCcDVaSumWF2PKHt85pc7fRvFuoVT8qFU= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.32.0/go.mod h1:Rl61tySSdcOJWoEgYZVtmnKdA0GeKrSqkHC1t+91CH8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0/go.mod h1:TMu73/k1CP8nBUpDLc71Wj/Kf7ZS9FK5b53VapRsP9o= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4= +go.opentelemetry.io/otel/exporters/prometheus v0.54.0 h1:rFwzp68QMgtzu9PgP3jm9XaMICI6TsofWWPcBDKwlsU= +go.opentelemetry.io/otel/exporters/prometheus v0.54.0/go.mod h1:QyjcV9qDP6VeK5qPyKETvNjmaaEc7+gqjh4SS0ZYzDU= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 h1:TwmL3O3fRR80m8EshBrd8YydEZMcUCsZXzOUlnFohwM= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0/go.mod h1:tH98dDv5KPmPThswbXA0fr0Lwfs+OhK8HgaCo7PjRrk= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.32.0 h1:SZmDnHcgp3zwlPBS2JX2urGYe/jBKEIT6ZedHRUyCz8= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.32.0/go.mod h1:fdWW0HtZJ7+jNpTKUR0GpMEDP69nR8YBJQxNiVCE3jk= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 h1:UGZ1QwZWY67Z6BmckTU+9Rxn04m2bD3gD6Mk0OIOCPk= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64= +go.opentelemetry.io/otel/log v0.8.0 h1:egZ8vV5atrUWUbnSsHn6vB8R21G2wrKqNiDt3iWertk= +go.opentelemetry.io/otel/log v0.8.0/go.mod h1:M9qvDdUTRCopJcGRKg57+JSQ9LgLBrwwfC32epk5NX8= +go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ= +go.opentelemetry.io/otel/metric v1.33.0/go.mod h1:L9+Fyctbp6HFTddIxClbQkjtubW6O9QS3Ann/M82u6M= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/sdk/log v0.7.0 h1:dXkeI2S0MLc5g0/AwxTZv6EUEjctiH8aG14Am56NTmQ= +go.opentelemetry.io/otel/sdk/log v0.7.0/go.mod h1:oIRXpW+WD6M8BuGj5rtS0aRu/86cbDV/dAfNaZBIjYM= +go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU= +go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ= +go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s= +go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0= +gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422 h1:3UsHvIr4Wc2aW4brOaSCmcxh9ksica6fHEr8P1XhkYw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4= +google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU= +google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= +google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU= +google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/receiver/gitlabreceiver/internal/metadata/generated_status.go b/receiver/gitlabreceiver/internal/metadata/generated_status.go new file mode 100644 index 000000000000..733e05fb0fd6 --- /dev/null +++ b/receiver/gitlabreceiver/internal/metadata/generated_status.go @@ -0,0 +1,16 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/component" +) + +var ( + Type = component.MustNewType("gitlab") + ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitlabreceiver" +) + +const ( + TracesStability = component.StabilityLevelDevelopment +) diff --git a/receiver/gitlabreceiver/metadata.yaml b/receiver/gitlabreceiver/metadata.yaml new file mode 100644 index 000000000000..4df4990025da --- /dev/null +++ b/receiver/gitlabreceiver/metadata.yaml @@ -0,0 +1,13 @@ +type: gitlab + +status: + class: receiver + stability: + development: [traces] + distributions: [] + codeowners: + active: [adrielp, atoulme] +tests: + config: + webhook: + endpoint: "localhost:0" #dynamic port allocation to avoid falky tests \ No newline at end of file diff --git a/receiver/gitlabreceiver/testdata/config.yaml b/receiver/gitlabreceiver/testdata/config.yaml new file mode 100644 index 000000000000..c9e3ccfb96e0 --- /dev/null +++ b/receiver/gitlabreceiver/testdata/config.yaml @@ -0,0 +1,36 @@ +receivers: + gitlab: + webhook: + endpoint: localhost:8080 + read_timeout: "500ms" + write_timeout: "500ms" + path: "some/path" + health_path: "health/path" + required_headers: + key1-present: "value1-present" + + gitlab/customname: + webhook: + endpoint: localhost:8080 + read_timeout: "500ms" + write_timeout: "500ms" + path: "some/path" + health_path: "health/path" + required_headers: + key1-present: "value1-present" + key2-present: "value2-present" + User-Agent: "GitLab/1.2.3-custom-version" + X-Gitlab-Instance: "https://gitlab.self-hosted.xyz" + +processors: + nop: + +exporters: + nop: + +service: + pipelines: + traces: + receivers: [gitlab, gitlab/customname] + processors: [nop] + exporters: [nop] \ No newline at end of file diff --git a/receiver/gitlabreceiver/traces_receiver.go b/receiver/gitlabreceiver/traces_receiver.go new file mode 100644 index 000000000000..7d753700cef1 --- /dev/null +++ b/receiver/gitlabreceiver/traces_receiver.go @@ -0,0 +1,114 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package gitlabreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitlabreceiver" + +import ( + "context" + "errors" + "fmt" + "net/http" + "sync" + + "github.com/gorilla/mux" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/receiverhelper" + "go.uber.org/zap" +) + +const healthyResponse = `{"text": "GitLab receiver webhook is healthy"}` + +type gitlabTracesReceiver struct { + cfg *Config + settings receiver.Settings + traceConsumer consumer.Traces + obsrecv *receiverhelper.ObsReport + server *http.Server + shutdownWG sync.WaitGroup + logger *zap.Logger +} + +func newTracesReceiver(settings receiver.Settings, cfg *Config, traceConsumer consumer.Traces) (*gitlabTracesReceiver, error) { + transport := "http" + if cfg.WebHook.TLSSetting != nil { + transport = "https" + } + + obsrecv, err := receiverhelper.NewObsReport(receiverhelper.ObsReportSettings{ + ReceiverID: settings.ID, + Transport: transport, + ReceiverCreateSettings: settings, + }) + if err != nil { + return nil, err + } + + gtr := &gitlabTracesReceiver{ + traceConsumer: traceConsumer, + cfg: cfg, + settings: settings, + logger: settings.Logger, + obsrecv: obsrecv, + } + + return gtr, nil +} + +func (gtr *gitlabTracesReceiver) Start(ctx context.Context, host component.Host) error { + endpoint := fmt.Sprintf("%s%s", gtr.cfg.WebHook.Endpoint, gtr.cfg.WebHook.Path) + gtr.logger.Info("Starting GitLab WebHook receiving server", zap.String("endpoint", endpoint)) + + // noop if not nil. if start has not been called before these values should be nil. + if gtr.server != nil && gtr.server.Handler != nil { + return nil + } + + // create listener from config + ln, err := gtr.cfg.WebHook.ServerConfig.ToListener(ctx) + if err != nil { + return err + } + + // use gorilla mux to set up a router + router := mux.NewRouter() + + // setup health route + router.HandleFunc(gtr.cfg.WebHook.HealthPath, gtr.handleHealthCheck) + + // webhook server standup and configuration + gtr.server, err = gtr.cfg.WebHook.ServerConfig.ToServer(ctx, host, gtr.settings.TelemetrySettings, router) + if err != nil { + return err + } + gtr.logger.Info("Health check now listening at", zap.String("health_path", fmt.Sprintf("%s%s", gtr.cfg.WebHook.Endpoint, gtr.cfg.WebHook.HealthPath))) + + gtr.shutdownWG.Add(1) + go func() { + defer gtr.shutdownWG.Done() + if errHTTP := gtr.server.Serve(ln); !errors.Is(errHTTP, http.ErrServerClosed) && errHTTP != nil { + componentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(errHTTP)) + } + }() + + return nil +} + +func (gtr *gitlabTracesReceiver) Shutdown(ctx context.Context) error { + if gtr.server != nil { + err := gtr.server.Shutdown(ctx) + return err + } + gtr.shutdownWG.Wait() + return nil +} + +// Simple healthcheck endpoint. +func (gtr *gitlabTracesReceiver) handleHealthCheck(w http.ResponseWriter, _ *http.Request) { + w.Header().Add("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + + _, _ = w.Write([]byte(healthyResponse)) +} diff --git a/receiver/gitlabreceiver/traces_receiver_test.go b/receiver/gitlabreceiver/traces_receiver_test.go new file mode 100644 index 000000000000..355c993bf81e --- /dev/null +++ b/receiver/gitlabreceiver/traces_receiver_test.go @@ -0,0 +1,36 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package gitlabreceiver + +import ( + "context" + "net/http" + "net/http/httptest" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver/receivertest" +) + +func TestHealthCheck(t *testing.T) { + defaultConfig := createDefaultConfig().(*Config) + defaultConfig.WebHook.Endpoint = "localhost:0" + consumer := consumertest.NewNop() + receiver, err := newTracesReceiver(receivertest.NewNopSettings(), defaultConfig, consumer) + require.NoError(t, err, "failed to create receiver") + + r := receiver + require.NoError(t, r.Start(context.Background(), componenttest.NewNopHost()), "failed to start receiver") + defer func() { + require.NoError(t, r.Shutdown(context.Background()), "failed to shutdown revceiver") + }() + + w := httptest.NewRecorder() + r.handleHealthCheck(w, httptest.NewRequest(http.MethodGet, "http://localhost/health", nil)) + + response := w.Result() + require.Equal(t, http.StatusOK, response.StatusCode) +} diff --git a/versions.yaml b/versions.yaml index c44692c506a9..8dc8a837cf9a 100644 --- a/versions.yaml +++ b/versions.yaml @@ -220,6 +220,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/flinkmetricsreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/fluentforwardreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver + - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitlabreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudpubsubreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudspannerreceiver