Skip to content

Commit

Permalink
Merge branch 'main' into initial_systemdreceiver
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored Oct 17, 2024
2 parents 60e4ae6 + cf25636 commit 9583b48
Show file tree
Hide file tree
Showing 48 changed files with 1,020 additions and 83 deletions.
27 changes: 27 additions & 0 deletions .chloggen/azure-events-receiver-translator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: azureeventshubreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Updates the Azure Event Hub receiver to use the new Resource Logs translator.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35357]

# (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:

# 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: []
27 changes: 27 additions & 0 deletions .chloggen/bugfix_compressionTypeFix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'bug_fix'

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: azuredataexplorerexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fix compression type for Azure Data Explorer exporter by adding the compression type in ingestion properties.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35353]

# (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:

# 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]
27 changes: 27 additions & 0 deletions .chloggen/cloudflare-receiver-contract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: cloudflarereceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Respond 503 on non-permanent and 400 on permanent errors

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35642]

# (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:

# 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: []
13 changes: 13 additions & 0 deletions .chloggen/feat_opampextension-support-auth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: opampextension

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Support using auth extensions for authenticating with opamp servers"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35507]
27 changes: 27 additions & 0 deletions .chloggen/jm-prom-translation-fix-comparison-func.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: pkg/translator/prometheusremotewrite

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fix metric comparison func in prom translation layer

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35741]

# (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:

# 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]
27 changes: 27 additions & 0 deletions .chloggen/jm-prom-translation-rw2-gauges-support.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: pkg/translator/prometheusremotewrite

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: add FromMetricsV2

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [33661]

# (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: The public function is partially implemented and not ready for use

# 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: [api]
27 changes: 27 additions & 0 deletions .chloggen/remove-experimental-metrics-generator-prefix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: processor/metricsgeneration

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove "experimental_" prefix from metrics generator processor name.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35426]

# (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:

# 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]
5 changes: 2 additions & 3 deletions .github/workflows/build-and-test-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [otel-linux-arm64, macos-14]
group:
- receiver-0
- receiver-1
Expand All @@ -46,7 +45,7 @@ jobs:
- cmd-1
- other
timeout-minutes: 30
runs-on: ${{ matrix.os }}
runs-on: otel-linux-arm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -61,7 +60,7 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
key: go-build-cache-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
key: go-build-cache-otel-linux-arm64-go-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build-and-test-darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ env:
# Make sure to exit early if cache segment download times out after 2 minutes.
# We limit cache download as a whole to 5 minutes.
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
GOPROXY: https://goproxy1.cncf.selfactuated.dev,direct

# Do not cancel this workflow on main. See https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/16616
concurrency:
Expand Down
1 change: 1 addition & 0 deletions cmd/otelcontribcol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ replaces:
- github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector => ../../connector/spanmetricsconnector
- github.com/openshift/api v3.9.0+incompatible => github.com/openshift/api v0.0.0-20180801171038-322a19404e37
- github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azure => ../../pkg/translator/azure
- github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azurelogs => ../../pkg/translator/azurelogs
- github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/skywalking => ../../pkg/translator/skywalking
- github.com/open-telemetry/opentelemetry-collector-contrib/internal/collectd => ../../internal/collectd
- github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding => ../../extension/encoding
Expand Down
2 changes: 2 additions & 0 deletions exporter/azuredataexplorerexporter/adx_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/Azure/azure-kusto-go/kusto"
kustoerrors "github.com/Azure/azure-kusto-go/kusto/data/errors"
"github.com/Azure/azure-kusto-go/kusto/ingest"
"github.com/Azure/azure-kusto-go/kusto/ingest/ingestoptions"
jsoniter "github.com/json-iterator/go"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/plog"
Expand Down Expand Up @@ -160,6 +161,7 @@ func newExporter(config *Config, logger *zap.Logger, telemetryDataType int, vers

var ingestOptions []ingest.FileOption
ingestOptions = append(ingestOptions, ingest.FileFormat(ingest.JSON))
ingestOptions = append(ingestOptions, ingest.CompressionType(ingestoptions.GZIP))
// Expect that this mapping is already existent
if refOption := getMappingRef(config, telemetryDataType); refOption != nil {
ingestOptions = append(ingestOptions, refOption)
Expand Down
2 changes: 2 additions & 0 deletions extension/opampextension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The following settings are optional for the websocket client:
- `ws`: The OpAMP websocket transport settings.
- `tls`: TLS settings.
- `headers`: HTTP headers to set.
- `auth`: The ID of an auth extension to use for authentication.

The following settings are optional for the HTTP client:

Expand All @@ -33,6 +34,7 @@ The following settings are optional for the HTTP client:
- `tls`: TLS settings.
- `headers`: HTTP headers to set.
- `polling_interval`: The interval at which the extension will poll the server. Defaults to 30s.
- `auth`: The ID of an auth extension to use for authentication.

The following settings are optional for both transports:

Expand Down
80 changes: 80 additions & 0 deletions extension/opampextension/auth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package opampextension // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/opampextension"

import (
"bytes"
"fmt"
"io"
"net/http"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/extension/auth"
"go.uber.org/zap"
)

// headerCaptureRoundTripper is a RoundTripper that captures the headers of the request
// that passes through it.
type headerCaptureRoundTripper struct {
lastHeader http.Header
}

func (h *headerCaptureRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
h.lastHeader = req.Header.Clone()
// Dummy response is recorded here
return &http.Response{
Status: "200 OK",
StatusCode: 200,
Proto: "HTTP/1.0",
ProtoMajor: 1,
ProtoMinor: 0,
Body: io.NopCloser(&bytes.Buffer{}),
Request: req,
}, nil
}

func makeHeadersFunc(logger *zap.Logger, serverCfg *OpAMPServer, host component.Host) (func(http.Header) http.Header, error) {
var emptyComponentID component.ID
if serverCfg == nil || serverCfg.GetAuthExtensionID() == emptyComponentID {
return nil, nil
}

extID := serverCfg.GetAuthExtensionID()
ext, ok := host.GetExtensions()[extID]
if !ok {
return nil, fmt.Errorf("could not find auth extension %q", extID)
}

authExt, ok := ext.(auth.Client)
if !ok {
return nil, fmt.Errorf("auth extension %q is not an auth.Client", extID)
}

hcrt := &headerCaptureRoundTripper{}
rt, err := authExt.RoundTripper(hcrt)
if err != nil {
return nil, fmt.Errorf("could not create roundtripper for authentication: %w", err)
}

return func(h http.Header) http.Header {
// This is a workaround while websocket authentication is being worked on.
// Currently, we are waiting on the auth module to be stabilized.
// See for more info: https://github.com/open-telemetry/opentelemetry-collector/issues/10864
dummyReq, err := http.NewRequest("GET", "http://example.com", nil)
if err != nil {
logger.Error("Failed to create dummy request for authentication.", zap.Error(err))
return h
}

dummyReq.Header = h

_, err = rt.RoundTrip(dummyReq)
if err != nil {
logger.Error("Error while performing round-trip for authentication.", zap.Error(err))
return h
}

return hcrt.lastHeader
}, nil
}
Loading

0 comments on commit 9583b48

Please sign in to comment.