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

Update OTelCol to Alpha v0.2.0 #24

Merged
merged 1 commit into from
Oct 4, 2019

Conversation

pjanotti
Copy link
Contributor

@pjanotti pjanotti commented Oct 4, 2019

Update go.mod to OTelCol Alpha v0.2.0

@pjanotti pjanotti merged commit a662bb1 into open-telemetry:master Oct 4, 2019
@pjanotti pjanotti deleted the update-otelcol-to-alpha branch October 4, 2019 15:57
mxiamxia referenced this pull request in mxiamxia/opentelemetry-collector-contrib Jul 22, 2020
* interceptor: add zipkin interceptor

* Zipkin interceptor multiplexing + running on 9411

* Can receive spans from diverse sources and successfully
intercept traces from various serviceNames and IPv* combinations.
Verified by examining the data on the Zipkin UI itself by
resending to a server running on a different port.

* End-to-end serialization tests where we intercept JSON
from a wild Zipkin reporter, transform it into trace-proto
then to OpenCensus-Go SpanData and then export it with the
OpenCensus-Go Zipkin exporter, inspect the JSON and compare
it with the final/expected JSON data.

Fixes #24

* interceptor/zipkin: add remoteEndpoint to Node.Attributes

Zipkin's RemoteEndpoint field is necessary when later on
building the dependency graph for Zipkin services.

This change ensures that that field is added as an attribute
to the Node with keys whose prefix is:
  "zipkin.remoteEndpoint." e.g.

- "zipkin.remoteEndpoint.ipv4"
- "zipkin.remoteEndpoint.serviceName"
- "zipkin.remoteEndpoint.port"

* Fail if Zipkin interceptor and exporter run on same address

Fail spectacularly if the Zipkin interceptor and the Zipkin
exporter will all be run on the same address.
This is because this is a self DOS vector as intercepted spans
will be processed by the interceptor, then exported out by
the exporter but instead those exported spans will then be
sent back to the interceptor and this goes on indefinitely
and will just consume memory and resources.

To perform this check:
a) Compare HostPorts of interceptor vs exporter
b) If say "127.0.0.1", "localhost", "" for host and the ports
match
c) Resolve the IPs for the hosts

if any of those steps match return a logical conflict error
which will be thrown later.

The crash will look something like this
```shell
2018/10/23 18:54:41 Configuration logical error: ZipkinInterceptor address ("127.0.0.1:9411") aka (127.0.0.1 on port 9411)
is the same as the interceptor address ("localhost:9411") aka (127.0.0.1 on port 9411)
```

We can now detect any of these clashing configurations:

```yaml
interceptors:
    zipkin:
        address: "127.0.0.1:9411"
exporters:
    zipkin:
        endpoint: "http://localhost:9411/api/v2/spans"
```

```yaml
interceptors:
    zipkin:
        address: ":9411"

exporters:
    zipkin:
        endpoint: "http://localhost:9411/api/v2/spans"
```

```yaml
interceptors:
    zipkin:
        address: "localhost:9411"

exporters:
    zipkin:
        endpoint: "http://localhost:9411/api/v2/spans"
```

```yaml
interceptors:
    zipkin:
        address: "localhost:9411"

exporters:
    zipkin:
        endpoint: "http://:9411/api/v2/spans"
```

```yaml
interceptors:
    zipkin:
        address: "localhost:9411"

exporters:
    zipkin:
        endpoint: "http://127.0.0.1:9411/api/v2/spans"
```

and in a case where IP resolution helped, "10.0.0.147" is my local
address and I sneakishly tried to get the interceptor on "localhost"
which clashes with my local address as per:

```yaml
interceptors:
    zipkin:
        address: "localhost:9411"

exporters:
    zipkin:
        endpoint: "http://10.0.0.147:9411/api/v2/spans"
```

we caught it
```shell
2018/10/23 19:01:01 Configuration logical error: ZipkinInterceptor address ("10.0.0.147:9411") aka (10.0.0.147 on port 9411)
is the same as the interceptor address ("localhost:9411") aka (10.0.0.147 on port 9411)
```

* Go fmt with Go1.10 to match TravisCI

Go1.11's gofmt seems to be more conservating with
aligning literal assignments while Go1.10 seems more
extravagant. This subtle difference was causing TravisCI
failures since TravisCI uses Go1.10.

* interceptor/zipkin: handle compressed HTTP bodies

Some clients such as Zipkin-Java send HTTP bodies
with JSON that's been compressed as "gzip".
This change handles "Content-Encoding" values of:
* "gzip"
* "deflate", "zlib"
and decompresses them accordingly

* interceptor/zipkin: tests use anagram signature

A test that checked for raffled output before used an
"xorChecksum" but that's not really always unique.
The better way is to use an anagram counter, then
create a signature from the serialized map of counted
runes.

* interceptor/zipkin: address review feedback

* Package rename to "zipkinterceptor" --> "zipkininterceptor"
* Fix error names

* Address feedback from review

* move "zipkinRoute" const to the top to make it easily
discoverable and not be buried deep in code
* set status of zipkin interceptor if we encounter an error
while parsing spans. We set the span status to: StatusInvalidArgument
and the error message

* *zipkin: address feedback from review

* Add a comment ot exporter/exporterparse.zipkinExporter
that the mutex "mu" protects all the constituent fields
* Fix and ensure that node uniqueness is clear, with the
proper check from a map lookup but also rename the variable
to store nodes to "uniqueNodes" to make for better code readability

* README.md + default config.yaml: update interceptors docs and information

Added a section in the README.md on the various interceptors
and how to change the Zipkin interceptor address

* sync.Mutex instead of sync.RWMutex for zipkinExporter.mu
mxiamxia referenced this pull request in mxiamxia/opentelemetry-collector-contrib Jul 22, 2020
Address #24 though you should use
census-instrumentation/opencensus-service for now
bogdandrutu pushed a commit that referenced this pull request May 12, 2022
* add syslog input operator
codeboten pushed a commit that referenced this pull request Nov 23, 2022
* Add .pylintrc based on OpenCensus (related #6).

* Fix/disable pylint warnings.

* pylint: Fix W0107: Unnecessary pass statement (unnecessary-pass)

I'm not sure I like this warning.
sky333999 pushed a commit to sky333999/opentelemetry-collector-contrib that referenced this pull request Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants