Skip to content

Commit

Permalink
Merge branch 'main' into servicegraphconnector-virtualnodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ogxd authored Apr 5, 2024
2 parents b2723fa + c3e7965 commit 1ada7e4
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exporter/coralogixexporter/ @open-telemetry/collect
exporter/datadogexporter/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @liustanley @songy23 @mackjmr
exporter/datasetexporter/ @open-telemetry/collector-contrib-approvers @atoulme @martin-majlis-s1 @zdaratom-s1 @tomaz-s1
exporter/dynatraceexporter/ @open-telemetry/collector-contrib-approvers @dyladan @arminru @evan-bradley
exporter/elasticsearchexporter/ @open-telemetry/collector-contrib-approvers @JaredTan95
exporter/elasticsearchexporter/ @open-telemetry/collector-contrib-approvers @JaredTan95 @ycombinator
exporter/fileexporter/ @open-telemetry/collector-contrib-approvers @atingchen
exporter/googlecloudexporter/ @open-telemetry/collector-contrib-approvers @aabmass @dashpole @jsuereth @punya @damemi @psx95
exporter/googlecloudpubsubexporter/ @open-telemetry/collector-contrib-approvers @alexvanboxel
Expand Down
2 changes: 1 addition & 1 deletion exporter/elasticsearchexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
| Stability | [beta]: traces, logs |
| Distributions | [contrib] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Felasticsearch%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Felasticsearch) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Felasticsearch%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Felasticsearch) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@JaredTan95](https://www.github.com/JaredTan95) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@JaredTan95](https://www.github.com/JaredTan95), [@ycombinator](https://www.github.com/ycombinator) |

[beta]: https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
Expand Down
2 changes: 1 addition & 1 deletion exporter/elasticsearchexporter/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ status:
beta: [traces, logs]
distributions: [contrib]
codeowners:
active: [JaredTan95]
active: [JaredTan95, ycombinator]

tests:
config:
Expand Down
23 changes: 10 additions & 13 deletions pkg/ottl/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"bytes"
"time"

"go.uber.org/zap"
"golang.org/x/exp/constraints"
)

Expand All @@ -17,9 +16,7 @@ import (

// invalidComparison returns false for everything except ne (where it returns true to indicate that the
// objects were definitely not equivalent).
// It also gives us an opportunity to log something.
func (p *Parser[K]) invalidComparison(msg string, op compareOp) bool {
p.telemetrySettings.Logger.Debug(msg, zap.Any("op", op))
func (p *Parser[K]) invalidComparison(op compareOp) bool {
return op == ne
}

Expand Down Expand Up @@ -87,7 +84,7 @@ func (p *Parser[K]) compareBool(a bool, b any, op compareOp) bool {
case bool:
return compareBools(a, v, op)
default:
return p.invalidComparison("bool to non-bool", op)
return p.invalidComparison(op)
}
}

Expand All @@ -96,7 +93,7 @@ func (p *Parser[K]) compareString(a string, b any, op compareOp) bool {
case string:
return comparePrimitives(a, v, op)
default:
return p.invalidComparison("string to non-string", op)
return p.invalidComparison(op)
}
}

Expand All @@ -110,7 +107,7 @@ func (p *Parser[K]) compareByte(a []byte, b any, op compareOp) bool {
}
return compareBytes(a, v, op)
default:
return p.invalidComparison("Bytes to non-Bytes", op)
return p.invalidComparison(op)
}
}

Expand All @@ -121,7 +118,7 @@ func (p *Parser[K]) compareInt64(a int64, b any, op compareOp) bool {
case float64:
return comparePrimitives(float64(a), v, op)
default:
return p.invalidComparison("int to non-numeric value", op)
return p.invalidComparison(op)
}
}

Expand All @@ -132,7 +129,7 @@ func (p *Parser[K]) compareFloat64(a float64, b any, op compareOp) bool {
case float64:
return comparePrimitives(a, v, op)
default:
return p.invalidComparison("float to non-numeric value", op)
return p.invalidComparison(op)
}
}

Expand All @@ -143,7 +140,7 @@ func (p *Parser[K]) compareDuration(a time.Duration, b any, op compareOp) bool {
vnsecs := v.Nanoseconds()
return comparePrimitives(ansecs, vnsecs, op)
default:
return p.invalidComparison("cannot compare invalid duration", op)
return p.invalidComparison(op)
}
}

Expand All @@ -164,10 +161,10 @@ func (p *Parser[K]) compareTime(a time.Time, b any, op compareOp) bool {
case gt:
return a.After(v)
default:
return p.invalidComparison("invalid comparison operator", op)
return p.invalidComparison(op)
}
default:
return p.invalidComparison("time to non-time value", op)
return p.invalidComparison(op)
}
}

Expand Down Expand Up @@ -211,7 +208,7 @@ func (p *Parser[K]) compare(a any, b any, op compareOp) bool {
case ne:
return a != b
default:
return p.invalidComparison("unsupported type for inequality on left", op)
return p.invalidComparison(op)
}
}
}
35 changes: 34 additions & 1 deletion pkg/stanza/fileconsumer/matcher/matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,40 @@ func TestMatcher(t *testing.T) {
},
expected: []string{"err.b.1.2023020602.log"},
},
}
{
name: "Recursive match - include",
files: []string{
"a/1.log",
"a/2.log",
"a/b/1.log",
"a/b/2.log",
"a/b/c/1.log",
"a/b/c/2.log",
},
include: []string{"**/1.log"},
exclude: []string{},
expected: []string{
"a/1.log",
"a/b/1.log",
"a/b/c/1.log",
},
},
{
name: "Recursive match - include and exclude",
files: []string{
"a/1.log",
"a/2.log",
"a/b/1.log",
"a/b/2.log",
"a/b/c/1.log",
"a/b/c/2.log",
},
include: []string{"**/1.log"},
exclude: []string{"**/b/**/1.log"},
expected: []string{
"a/1.log",
},
}}

for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
Expand Down
14 changes: 14 additions & 0 deletions receiver/zookeeperreceiver/package_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package zookeeperreceiver

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
37 changes: 28 additions & 9 deletions receiver/zookeeperreceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,16 @@ func TestZookeeperMetricsScraperScrape(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
localAddr := testutil.GetAvailableLocalAddress(t)
if !tt.mockZKConnectionErr {
ms := mockedServer{ready: make(chan bool, 1)}
go ms.mockZKServer(t, localAddr, tt.mockedZKCmdToOutputFilename)
listener, err := net.Listen("tcp", localAddr)
require.NoError(t, err)
ms := mockedServer{
listener: listener,
ready: make(chan bool, 1),
quit: make(chan struct{}),
}

defer ms.shutdown()
go ms.mockZKServer(t, tt.mockedZKCmdToOutputFilename)
<-ms.ready
}

Expand Down Expand Up @@ -337,19 +345,26 @@ func TestZookeeperShutdownBeforeScrape(t *testing.T) {
}

type mockedServer struct {
listener net.Listener

ready chan bool
quit chan struct{}
}

func (ms *mockedServer) mockZKServer(t *testing.T, endpoint string, cmdToFileMap map[string]string) {
func (ms *mockedServer) mockZKServer(t *testing.T, cmdToFileMap map[string]string) {
var cmd string
listener, err := net.Listen("tcp", endpoint)
require.NoError(t, err)
defer listener.Close()
ms.ready <- true

for {
conn, err := listener.Accept()
require.NoError(t, err)
conn, err := ms.listener.Accept()
if err != nil {
select {
case <-ms.quit:
return
default:
require.NoError(t, err)
}
}
reader := bufio.NewReader(conn)
scanner := bufio.NewScanner(reader)
scanner.Scan()
Expand All @@ -366,6 +381,10 @@ func (ms *mockedServer) mockZKServer(t *testing.T, endpoint string, cmdToFileMap
require.NoError(t, err)

conn.Close()

}
}

func (ms *mockedServer) shutdown() {
close(ms.quit)
ms.listener.Close()
}

0 comments on commit 1ada7e4

Please sign in to comment.