-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Create a skeleton for the 'blobuploadprocessor'. #35966
Changes from 6 commits
5147353
849cd8a
f7e9c1b
208a79c
bbf3f40
66ae274
e77c553
381ac12
b4a9b83
80976e9
929e38a
4f145a0
77dd408
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
change_type: new_component | ||
component: blobuploadconnector | ||
note: Connector for uploading and replacing pieces of a signal to blob storage | ||
issues: [33737] | ||
subtext: Skeleton implementation at the moment. | ||
change_logs: [] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ body: | |
- confmap/provider/aesprovider | ||
- confmap/provider/s3provider | ||
- confmap/provider/secretsmanagerprovider | ||
- connector/blobupload | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update to processor |
||
- connector/count | ||
- connector/datadog | ||
- connector/exceptions | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ body: | |
- confmap/provider/aesprovider | ||
- confmap/provider/s3provider | ||
- confmap/provider/secretsmanagerprovider | ||
- connector/blobupload | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update to processor |
||
- connector/count | ||
- connector/datadog | ||
- connector/exceptions | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../Makefile.Common |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Blob Upload Connector | ||
|
||
<!-- status autogenerated section --> | ||
<!-- end autogenerated section --> | ||
|
||
## Status | ||
|
||
Under development. | ||
|
||
This code is a skeleton only. Follow implementation at [#33737](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33737) ("New component: Blob Uploader Connector"). | ||
|
||
## What It Does | ||
|
||
1. Queues an upload for specified pieces of a signal to a configured blob storage destination. | ||
2. Replaces the original data with a reference to where the blob was written. | ||
3. Forwards the modified signal to subsequent pipeline (to be exported per normal). | ||
|
||
## Motivation | ||
|
||
1. Handling overly large pieces of a signal that may be too big for a typical ops backend | ||
2. Handling sensitive information by sending to an alternative system with tighter ACLs | ||
|
||
## Config | ||
|
||
The configuration will look roughly as follows: | ||
|
||
``` | ||
blobuploadconnector: | ||
common: ... | ||
traces: ... | ||
logs: ... | ||
``` | ||
|
||
As shown above, there will be some set of common configuration that applies by default to all signal types. | ||
|
||
Each signal type will have its own config for how it will be processed. | ||
|
||
### Common Config | ||
|
||
The common configuration governs things like how to upload the data: | ||
|
||
``` | ||
blobuploadconnector: | ||
common: | ||
upload: | ||
queue_size: 100 | ||
timeout_nanos: 5000 | ||
... | ||
``` | ||
|
||
The `queue_size` indicates the maximum number of parallel uploads; the `timeout_nanos` specifies the timeout on uploading. | ||
|
||
### Traces Config | ||
|
||
The traces configuration governs how to match trace spans and span events. It will look roughly as follows: | ||
|
||
``` | ||
blobuploadconnector: | ||
traces: | ||
# matching attributes on spans | ||
attributes: ... | ||
# matching (groups of) span events and their attributes | ||
events: ... | ||
... | ||
``` | ||
|
||
### Logs Config | ||
|
||
The logs configuration governs how to match logs. It will look roughly as follows: | ||
|
||
``` | ||
blobuploadconnector: | ||
logs: | ||
groups: | ||
- name: ... | ||
match: ... | ||
body: ... | ||
attributes: ... | ||
... | ||
``` | ||
|
||
Each named group will match logs based on `match`. For matched logs, `attributes` will govern whether/how to upload attributes while `body` will govern whether/how to upload portions of the body. | ||
|
||
## See Also | ||
|
||
- [#1428](https://github.com/open-telemetry/semantic-conventions/issues/1428) - "Seeking input on proposal for 'reference'-type attribute values" | ||
- [#33737](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33737) - "New component: Blob Uploader Connector" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package blobuploadconnector | ||
|
||
// Config defines the overall configuration for this component. | ||
type Config struct { | ||
Common *CommonConfig `mapstructure:"common"` | ||
TracesConfig *TracesConfig `mapstructure:"traces"` | ||
LogsConfig *LogsConfig `mapstructure:"logs"` | ||
} | ||
|
||
// NewDefaultConfig instantiates a default, valid config. | ||
func NewDefaultConfig() *Config { | ||
return &Config{} | ||
} | ||
|
||
// Validate ensures that the configuration is valid. | ||
func (c *Config) Validate() error { | ||
// TODO: implement validation in subsequent PRs. | ||
return nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package blobuploadconnector | ||
|
||
// CommonConfig defines configuration that applies to multiple signal types. | ||
type CommonConfig struct{} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package blobuploadconnector |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package blobuploadconnector | ||
|
||
// LogsConfig defines configuration for the logs signal type. | ||
type LogsConfig struct{} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package blobuploadconnector |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package blobuploadconnector | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestDefaultConfigIsValid(t *testing.T) { | ||
cfg := NewDefaultConfig() | ||
assert.NotNil(t, cfg) | ||
assert.NoError(t, cfg.Validate()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package blobuploadconnector | ||
|
||
// TracesConfig defines configuration for the traces signal type. | ||
type TracesConfig struct{} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package blobuploadconnector |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package blobuploadconnector | ||
|
||
// Deps provides a means of mocking out dependencies in tests. | ||
type Deps interface { | ||
depsUnexported() | ||
} | ||
|
||
// Default implementation of Deps. | ||
type depsImpl struct{} | ||
|
||
func (*depsImpl) depsUnexported() {} | ||
|
||
// NewDeps provides access to the default, real version of deps. | ||
func NewDeps() Deps { | ||
return &depsImpl{} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:generate mdatagen metadata.yaml | ||
|
||
package blobuploadconnector |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package blobuploadconnector | ||
|
||
import ( | ||
"go.opentelemetry.io/collector/component" | ||
"go.opentelemetry.io/collector/connector" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/connector/blobuploadconnector/internal/metadata" | ||
) | ||
|
||
func createDefaultConfig() component.Config { | ||
return NewDefaultConfig() | ||
} | ||
|
||
// NewFactoryWithDeps instantiates the factory with dependency injection, allowing | ||
// for a more testable interface that allows global functions/objects to be swapped out. | ||
func NewFactoryWithDeps(deps Deps) connector.Factory { | ||
return connector.NewFactory( | ||
metadata.Type, | ||
createDefaultConfig, | ||
connector.WithTracesToTraces( | ||
createTracesToTracesConnector(deps), | ||
metadata.TracesToTracesStability), | ||
connector.WithLogsToLogs( | ||
createLogsToLogsConnector(deps), | ||
metadata.LogsToLogsStability)) | ||
} | ||
|
||
// NewFactory is used by the OTel collector to instantiate this component. | ||
func NewFactory() connector.Factory { | ||
return NewFactoryWithDeps(NewDeps()) | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update to processor