Commit Graph

7 Commits

Author SHA1 Message Date
Nathan Baulch 42e6304f65
Fix typos (#11348)
Just thought I'd contribute some typo fixes I stumbled upon. Nothing
controversial (hopefully), just 72 simple fixes.

Use the following command to get a quick and dirty summary of the
specific corrections made:
```shell
git diff HEAD^! --word-diff-regex='\w+' -U0 \
  | grep -E '\[\-.*\-\]\{\+.*\+\}' \
  | sed -r 's/.*\[\-(.*)\-\]\{\+(.*)\+\}.*/\1 \2/' \
  | sort | uniq -c | sort -n
```

FWIW, the top typos are:
* invokable (16)
* subsciption (15)
* decison (7)
* reques (3)
* dissallow (3)
* documenation (3)
* locahost (3)
* prerequistes (2)
* assinged (2)
* extenions (2)

---------

Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-10-09 15:43:52 -07:00
Bogdan Drutu edf7aca852
Remove circular dependency between default otel and connector (#9095)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-12-13 23:50:35 -08:00
Daniel Jaglowski 7ec38e5c19
Fanout consumer does not need to mutate in some cases (#9062)
Follow up to
https://github.com/open-telemetry/opentelemetry-collector/pull/9053.

@dmitryax pointed out
[here](https://github.com/open-telemetry/opentelemetry-collector/pull/9053#discussion_r1420871665)
that the fanout consumer will pass original data to a non-mutating
consumer if any is available. This PR incorporates that point and
updates test expectations accordingly.
2023-12-11 10:04:37 -08:00
Daniel Jaglowski 7c58e71515
Fix bug where MutatesData would not correctly propogate through connectors (#9053)
This fixes two closely related problems. 
1. While fanoutconsumers do not themselves mutate data, they should
expose whether or not they are handing data off to consumers which may
do so. Otherwise, the service cannot correctly determine how to fan out
after a receiver. e.g. a receiver shared between two pipelines, one of
which contains an exporter or connector which mutates data.
2. Connectors can themselves mutate data but we were not taking this
into account when building the graph.
2023-12-09 09:44:55 -08:00
Dmitrii Anoshin ec07258743
[fanoutconsumer] [chore] Do not wrap one read-only consumer (#8689)
A follow-up optimization after merging
https://github.com/open-telemetry/opentelemetry-collector/pull/8634.

There is no need to create a fanout consumer for only one read-only
consumer. This introduces a behavior that closely resembles its previous
state, before the introduction of the readonly/mutable states.
2023-10-17 09:08:04 -07:00
Dmitrii Anoshin 8a385c22e5
[pdata] Enable the pdata mutation safeguards in the fanout consumers (#8634)
This change enables the runtime assertions to catch unintentional pdata
mutations in components claiming as non-mutating pdata. Without these
assertions, runtime errors may still occur, but thrown by unrelated
components, making it very difficult to troubleshoot.

This required introducing extra API to get the pdata mutability state:
- p[metric|trace|log].[Metrics|Traces|Logs].IsReadOnly()

Resolves:
https://github.com/open-telemetry/opentelemetry-collector/issues/6794
2023-10-16 11:12:50 -07:00
Matthew Wear fd72651e14
Add helpers to construct `connector.*Router`s for tests (#7673)
This PR adds helpers to `connectortest` to aid the construction of
`connector.*Router`s for testing connectors. This was implemented based
on @djaglowski's [comment
here](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/21498#issuecomment-1542682841),
with some slight modifications. I found it more ergonomic to pass the
sink into the `WithTracesSink` (and similar) options. You usually want a
handle on the sink after creating the router. While it's possible to get
the sink out of the router after the fact, it's a little cumbersome.

These helpers will be useful for
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/21498
and future connectors that need use of routers.

For example, here is a test with the consumer passed in:

```go
func TestFanoutTracesWithSink(t *testing.T) {
    var sink0, sink1 consumertest.TracesSink

    tr, err := NewTracesRouterSink(
        WithTracesSink(component.NewIDWithName(component.DataTypeTraces, "0"), &sink0),
        WithTracesSink(component.NewIDWithName(component.DataTypeTraces, "1"), &sink1),
    )

    require.NoError(t, err)
    require.Equal(t, 0, sink0.SpanCount())
    require.Equal(t, 0, sink1.SpanCount())

    td := testdata.GenerateTraces(1)
    err = tr.(consumer.Traces).ConsumeTraces(context.Background(), td)

    require.NoError(t, err)
    require.Equal(t, 1, sink0.SpanCount())
    require.Equal(t, 1, sink1.SpanCount())
}

```

The same test having to extract the consumer out after the fact:

```go
func TestFanoutTracesWithSink(t *testing.T) {
    traces0 := component.NewIDWithName(component.DataTypeTraces, "0")
    traces1 := component.NewIDWithName(component.DataTypeTraces, "1")

    tr, err := NewTracesRouterSink(
        WithTracesSink(traces0),
        WithTracesSink(traces1),
    )
   
    require.NoError(t, err)
   
    cons0, _ := tr.Consumer(traces0)
    sink0 := cons0.(*consumertest.TracesSink)
    cons1, _ := tr.Consumer(traces1)
    sink1 := cons1.(*consumertest.TracesSink)

    require.Equal(t, 0, sink0.SpanCount())
    require.Equal(t, 0, sink1.SpanCount())

    td := testdata.GenerateTraces(1)
    err = tr.(consumer.Traces).ConsumeTraces(context.Background(), td)

    require.NoError(t, err)
    require.Equal(t, 1, sink0.SpanCount())
    require.Equal(t, 1, sink1.SpanCount())}
}
```


**Link to tracking Issue:** 
#7672

**Testing:**
Unit tests

**Documentation:**
Source code comments

---------

Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
2023-06-22 14:35:40 -07:00