Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs SDK prototype #4955

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
de48f62
Logs SDK prototype boilerplate
pellared Feb 21, 2024
8afcfee
Merge branch 'main' into sdk-log-prototype
pellared Feb 26, 2024
5b446fc
Add some boilerplate
pellared Feb 26, 2024
91b39de
go mod tidy
pellared Feb 26, 2024
9ea3658
Update to go 1.21
pellared Feb 26, 2024
c7d1f79
Merge branch 'main' into sdk-log-prototype
pellared Feb 27, 2024
5ee9c75
Merge branch 'main' into sdk-log-prototype
pellared Mar 6, 2024
c6ae341
go mod tidy
pellared Mar 6, 2024
dc30575
Design sketch
pellared Mar 6, 2024
fc65ef8
Add attr limit
pellared Mar 6, 2024
65429b0
Add BatchingOptions
pellared Mar 6, 2024
9b922c8
Refactor
pellared Mar 7, 2024
77d0f32
Document Batcher
pellared Mar 7, 2024
3a85f3c
go mod tidy
pellared Mar 7, 2024
c43ee32
Export must not retain slice
pellared Mar 8, 2024
c47bbda
Update exporter docs
pellared Mar 8, 2024
d3c396a
Refine exporter docs
pellared Mar 8, 2024
4d34145
Add Record.Clone
pellared Mar 8, 2024
dbc78c0
Record.AddAttributes
pellared Mar 8, 2024
c6ad6a2
SetAttributes clones
pellared Mar 8, 2024
f69c386
Variadic
pellared Mar 8, 2024
a3be268
Implement NewBatchingExporter
pellared Mar 8, 2024
611797c
Implement batcher
pellared Mar 8, 2024
be3d092
Fix batcher
pellared Mar 8, 2024
cc9b3cb
Implement Record.Clone
pellared Mar 8, 2024
f955348
Refactor batcher
pellared Mar 8, 2024
bc671fd
Improve batcher and implement provider
pellared Mar 8, 2024
66feb90
Implement logger
pellared Mar 8, 2024
5bc8f32
Logger to handle error
pellared Mar 8, 2024
fb09dd8
typo
pellared Mar 8, 2024
eb95ec4
Fix provider
pellared Mar 8, 2024
a66cf0b
Add benchmarks
pellared Mar 8, 2024
f89d751
Add benchmarks and zero allocation tests
pellared Mar 8, 2024
e31804f
Fix benchmarks
pellared Mar 8, 2024
f4f3f8a
Add comments
pellared Mar 8, 2024
c492a16
Update tests and comment
pellared Mar 8, 2024
a406e94
Make zero allocs on hot path
pellared Mar 8, 2024
d73beb5
Change Clone to return value
pellared Mar 8, 2024
410f8fe
Update exporter docs
pellared Mar 8, 2024
bbd5ab8
Add exporter as processor
pellared Mar 8, 2024
9b96da8
Add TestZeroAllocsNoSpan
pellared Mar 8, 2024
fd7e57b
Fix timestampDecorator
pellared Mar 8, 2024
29c90a0
Make SpanFromContext zero alloc when there is no span
pellared Mar 8, 2024
2f3b8a5
Set ObservedTimestamp if unspecified
pellared Mar 8, 2024
a033795
Merge branch 'main' into sdk-log-prototype
pellared Mar 11, 2024
8b70d18
go mod tidy
pellared Mar 11, 2024
876ddd6
Introduce Log processor (#9)
pellared Mar 11, 2024
dcf13a2
Update provider.go
pellared Mar 11, 2024
8b9a458
Update provider.go
pellared Mar 11, 2024
849a2a0
Update simple.go
pellared Mar 11, 2024
1589b56
Update simple.go
pellared Mar 11, 2024
ed357ac
Update exporter.go
pellared Mar 11, 2024
1e0a06a
Update batch.go
pellared Mar 11, 2024
c5d7dbb
Merge branch 'main' into sdk-log-prototype
pellared Mar 12, 2024
91e9bd3
Update Go doc comments
pellared Mar 12, 2024
462d361
Merge branch 'main' into sdk-log-prototype
pellared Mar 12, 2024
4ae4301
Update context.go
pellared Mar 12, 2024
07c6dc0
Merge branch 'main' into sdk-log-prototype
pellared Mar 12, 2024
91e97cb
Add SetTraceID SetSpanID SetTraceFlags to Record
pellared Mar 12, 2024
79ffb2d
Fix env var precedence
pellared Mar 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,24 @@ updates:
schedule:
interval: weekly
day: sunday
- package-ecosystem: gomod
directory: /exporters/otlp/otlplog/otlploggrpc
labels:
- dependencies
- go
- Skip Changelog
schedule:
interval: weekly
day: sunday
- package-ecosystem: gomod
directory: /exporters/otlp/otlplog/otlploghttp
labels:
- dependencies
- go
- Skip Changelog
schedule:
interval: weekly
day: sunday
- package-ecosystem: gomod
directory: /exporters/otlp/otlpmetric/otlpmetricgrpc
labels:
Expand Down Expand Up @@ -181,6 +199,15 @@ updates:
schedule:
interval: weekly
day: sunday
- package-ecosystem: gomod
directory: /exporters/stdout/stdoutlog
labels:
- dependencies
- go
- Skip Changelog
schedule:
interval: weekly
day: sunday
- package-ecosystem: gomod
directory: /exporters/stdout/stdoutmetric
labels:
Expand Down Expand Up @@ -253,6 +280,15 @@ updates:
schedule:
interval: weekly
day: sunday
- package-ecosystem: gomod
directory: /sdk/log
labels:
- dependencies
- go
- Skip Changelog
schedule:
interval: weekly
day: sunday
- package-ecosystem: gomod
directory: /sdk/metric
labels:
Expand Down
11 changes: 11 additions & 0 deletions exporters/otlp/otlplog/otlploggrpc/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc

go 1.20

require github.com/stretchr/testify v1.8.4

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 10 additions & 0 deletions exporters/otlp/otlplog/otlploggrpc/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
20 changes: 20 additions & 0 deletions exporters/otlp/otlplog/otlploggrpc/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package otlploggrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc"

// Version is the current release version of the OpenTelemetry OTLP over gRPC metrics exporter in use.
func Version() string {
return "1.23.1"
}
32 changes: 32 additions & 0 deletions exporters/otlp/otlplog/otlploggrpc/version_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package otlploggrpc

import (
"regexp"
"testing"

"github.com/stretchr/testify/assert"
)

// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1
var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` +
`(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` +
`(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`)

func TestVersionSemver(t *testing.T) {
v := Version()
assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v)
}
11 changes: 11 additions & 0 deletions exporters/otlp/otlplog/otlploghttp/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp

go 1.20

require github.com/stretchr/testify v1.8.4

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 10 additions & 0 deletions exporters/otlp/otlplog/otlploghttp/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
20 changes: 20 additions & 0 deletions exporters/otlp/otlplog/otlploghttp/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package otlploghttp // import "go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"

// Version is the current release version of the OpenTelemetry OTLP over HTTP/protobuf metrics exporter in use.
func Version() string {
return "1.23.1"
}
32 changes: 32 additions & 0 deletions exporters/otlp/otlplog/otlploghttp/version_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package otlploghttp

import (
"regexp"
"testing"

"github.com/stretchr/testify/assert"
)

// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1
var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` +
`(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` +
`(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`)

func TestVersionSemver(t *testing.T) {
v := Version()
assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v)
}
22 changes: 22 additions & 0 deletions exporters/stdout/stdoutlog/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package stdoutlog provides an exporter for OpenTelemetry log telemetry.
//
// The exporter is intended to be used for testing and debugging, it is not
// meant for production use. Additionally, it does not provide an interchange
// format for OpenTelemetry that is supported with any stability or
// compatibility guarantees. If these are needed features, please use the OTLP
// exporter instead.
package stdoutlog // import "go.opentelemetry.io/otel/exporters/stdout/stdoutlog"
23 changes: 23 additions & 0 deletions exporters/stdout/stdoutlog/exporter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package stdoutlog // import "go.opentelemetry.io/otel/exporters/stdout/stdoutlog"

// New returns a configured log exporter.
//
// If no options are passed, the default exporter returned will use a JSON
// encoder with tab indentations that output to STDOUT.
func New() (any, error) {
return nil, nil

Check warning on line 22 in exporters/stdout/stdoutlog/exporter.go

View check run for this annotation

Codecov / codecov/patch

exporters/stdout/stdoutlog/exporter.go#L21-L22

Added lines #L21 - L22 were not covered by tests
}
3 changes: 3 additions & 0 deletions exporters/stdout/stdoutlog/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module go.opentelemetry.io/otel/exporters/stdout/stdoutlog

go 1.20
Loading