Skip to content

Commit 8396ccb

Browse files
zdaratom-s1Caleb-Hurshman
authored andcommitted
DSET-3468: update dataset-go to latest, send more details in user-agent (open-telemetry#23640)
**Description:** updated dataset-go library, send more details in user-agent For more details see https://github.com/scalyr/dataset-go/releases/tag/v0.0.9 **Link to tracking Issue:** open-telemetry#20660 / DSET-3468 **Testing:** verified via unit tests and also e2e with DataSet environment **Documentation:** see https://github.com/scalyr/dataset-go/blob/fbaead7856a9c5669262564dfa4a13aa14a0775d/examples/readme/main.go#L81
1 parent 0581a74 commit 8396ccb

File tree

12 files changed

+44
-16
lines changed

12 files changed

+44
-16
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Use this changelog template to create an entry for release notes.
2+
# If your change doesn't affect end users, such as a test fix or a tooling change,
3+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
4+
5+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
6+
change_type: enhancement
7+
8+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
9+
component: exporter/datasetexporter
10+
11+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
12+
note: "Add more details to User-Agent header for DataSet HTTP requests"
13+
14+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
15+
issues: [20660]
16+
17+
# (Optional) One or more lines of additional information to render under the primary note.
18+
# These lines will be padded with 2 spaces and then inserted directly into the document.
19+
# Use pipe (|) for multiline entries.
20+
subtext:

cmd/configschema/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ require (
548548
github.com/relvacode/iso8601 v1.3.0 // indirect
549549
github.com/rs/cors v1.9.0 // indirect
550550
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.14 // indirect
551-
github.com/scalyr/dataset-go v0.0.8 // indirect
551+
github.com/scalyr/dataset-go v0.0.9 // indirect
552552
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646 // indirect
553553
github.com/secure-systems-lab/go-securesystemslib v0.5.0 // indirect
554554
github.com/segmentio/asm v1.2.0 // indirect

cmd/configschema/go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/otelcontribcol/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ require (
568568
github.com/rs/cors v1.9.0 // indirect
569569
github.com/samber/lo v1.37.0 // indirect
570570
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.14 // indirect
571-
github.com/scalyr/dataset-go v0.0.8 // indirect
571+
github.com/scalyr/dataset-go v0.0.9 // indirect
572572
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646 // indirect
573573
github.com/secure-systems-lab/go-securesystemslib v0.5.0 // indirect
574574
github.com/segmentio/asm v1.2.0 // indirect

cmd/otelcontribcol/go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/datasetexporter/datasetexporter.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/google/uuid"
1515
"github.com/scalyr/dataset-go/pkg/api/add_events"
1616
"github.com/scalyr/dataset-go/pkg/client"
17+
"go.opentelemetry.io/collector/exporter"
1718
"go.uber.org/zap"
1819
"golang.org/x/time/rate"
1920
)
@@ -27,7 +28,8 @@ type DatasetExporter struct {
2728
exporterCfg *ExporterConfig
2829
}
2930

30-
func newDatasetExporter(entity string, config *Config, logger *zap.Logger) (*DatasetExporter, error) {
31+
func newDatasetExporter(entity string, config *Config, set exporter.CreateSettings) (*DatasetExporter, error) {
32+
logger := set.Logger
3133
logger.Info("Creating new DataSetExporter",
3234
zap.String("config", config.String()),
3335
zap.String("entity", entity),
@@ -39,11 +41,17 @@ func newDatasetExporter(entity string, config *Config, logger *zap.Logger) (*Dat
3941
config.String(), err,
4042
)
4143
}
42-
44+
userAgent := fmt.Sprintf(
45+
"%s;%s;%s",
46+
"OtelCollector",
47+
set.BuildInfo.Version,
48+
entity,
49+
)
4350
client, err := client.NewClient(
4451
exporterCfg.datasetConfig,
4552
&http.Client{Timeout: time.Second * 60},
4653
logger,
54+
&userAgent,
4755
)
4856
if err != nil {
4957
logger.Error("Cannot create DataSetClient: ", zap.Error(err))

exporter/datasetexporter/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/google/uuid v1.3.0
77
// github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/filestorage v0.77.0
88
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.80.0
9-
github.com/scalyr/dataset-go v0.0.8
9+
github.com/scalyr/dataset-go v0.0.9
1010
github.com/stretchr/testify v1.8.4
1111
go.opentelemetry.io/collector/component v0.80.0
1212
go.opentelemetry.io/collector/confmap v0.80.0

exporter/datasetexporter/go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exporter/datasetexporter/logs_exporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var now = time.Now
2121

2222
func createLogsExporter(ctx context.Context, set exporter.CreateSettings, config component.Config) (exporter.Logs, error) {
2323
cfg := castConfig(config)
24-
e, err := newDatasetExporter("logs", cfg, set.Logger)
24+
e, err := newDatasetExporter("logs", cfg, set)
2525
if err != nil {
2626
return nil, fmt.Errorf("cannot get DataSetExpoter: %w", err)
2727
}

exporter/datasetexporter/traces_exporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const ServiceNameKey = "service.name"
2323

2424
func createTracesExporter(ctx context.Context, set exporter.CreateSettings, config component.Config) (exporter.Traces, error) {
2525
cfg := castConfig(config)
26-
e, err := newDatasetExporter("logs", cfg, set.Logger)
26+
e, err := newDatasetExporter("logs", cfg, set)
2727
if err != nil {
2828
return nil, fmt.Errorf("cannot get DataSetExpoter: %w", err)
2929
}

0 commit comments

Comments
 (0)