Skip to content

Commit 4a471a5

Browse files
authored
Merge pull request #15 from open-o11y/load-generator
Sig V4 Support in Prometheus Remote Write Exporter and OTLP Load generator for testing
2 parents e860b2b + 0a28999 commit 4a471a5

File tree

32 files changed

+4006
-197
lines changed

32 files changed

+4006
-197
lines changed

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ALL_SRC := $(shell find . -name '*.go' \
77
-not -path '*/internal/data/opentelemetry-proto-gen/*' \
88
-not -path './.circleci/scripts/reportgenerator/*' \
99
-not -path './examples/demo/app/*' \
10+
-not -path './test/*' \
1011
-type f | sort)
1112

1213
# ALL_PKGS is the list of all packages where ALL_SRC files reside.
@@ -31,6 +32,7 @@ STATIC_CHECK=staticcheck
3132
# BUILD_TYPE should be one of (dev, release).
3233
BUILD_TYPE?=release
3334

35+
3436
GIT_SHA=$(shell git rev-parse --short HEAD)
3537
BUILD_INFO_IMPORT_PATH=go.opentelemetry.io/collector/internal/version
3638
BUILD_X1=-X $(BUILD_INFO_IMPORT_PATH).GitHash=$(GIT_SHA)
@@ -49,6 +51,8 @@ all-srcs:
4951

5052
all-pkgs:
5153
@echo $(ALL_PKGS) | tr ' ' '\n' | sort
54+
all-env:
55+
@printenv
5256

5357
.DEFAULT_GOAL := all
5458

@@ -156,7 +160,7 @@ install-tools:
156160

157161
.PHONY: otelcol
158162
otelcol:
159-
GO111MODULE=on CGO_ENABLED=0 go build -o ./bin/otelcol_$(GOOS)_$(GOARCH)$(EXTENSION) $(BUILD_INFO) ./cmd/otelcol
163+
GO111MODULE=on CGO_ENABLED=0 go build -o ~/pipeline_custom/otelcol_$(GOOS)_$(GOARCH)$(EXTENSION) $(BUILD_INFO) ./cmd/otelcol
160164

161165
.PHONY: run
162166
run:
@@ -296,3 +300,15 @@ check-contrib:
296300
make -C $(CONTRIB_PATH) test
297301
@echo Restoring contrib to no longer use this core checkout
298302
make -C $(CONTRIB_PATH) for-all CMD="go mod edit -dropreplace go.opentelemetry.io/collector"
303+
304+
.PHONY: testaps
305+
testaps: otelcol run-colletor-to-aps send-load
306+
307+
.PHONY: run-colletor-to-aps
308+
run-colletor-to-aps:
309+
GO111MODULE=on go run --race ./cmd/otelcol/... --config ./test/otel-collector-config.yaml &
310+
311+
.PHONY: send-load
312+
send-load:
313+
@echo Starting OTLP load generator
314+
go run ./test/otlploadgenerator/*.go

README.md

Lines changed: 85 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,85 @@
1-
---
2-
3-
<p align="center">
4-
<strong>
5-
<a href="https://opentelemetry.io/docs/collector/about/">Getting Started<a/>
6-
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
7-
<a href="https://github.com/open-telemetry/community#agentcollector">Getting Involved<a/>
8-
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
9-
<a href="https://gitter.im/open-telemetry/opentelemetry-service">Getting In Touch<a/>
10-
</strong>
11-
</p>
12-
13-
<p align="center">
14-
<a href="https://goreportcard.com/report/github.com/open-telemetry/opentelemetry-collector">
15-
<img alt="Go Report Card" src="https://goreportcard.com/badge/github.com/open-telemetry/opentelemetry-collector?style=for-the-badge">
16-
</a>
17-
<a href="https://circleci.com/gh/open-telemetry/opentelemetry-collector">
18-
<img alt="Build Status" src="https://img.shields.io/circleci/build/github/open-telemetry/opentelemetry-collector?style=for-the-badge">
19-
</a>
20-
<a href="https://codecov.io/gh/open-telemetry/opentelemetry-collector/branch/master/">
21-
<img alt="Codecov Status" src="https://img.shields.io/codecov/c/github/open-telemetry/opentelemetry-collector?style=for-the-badge">
22-
</a>
23-
<a href="releases">
24-
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/open-telemetry/opentelemetry-collector?include_prereleases&style=for-the-badge">
25-
</a>
26-
<img alt="Beta" src="https://img.shields.io/badge/status-beta-informational?style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4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FsXjqIRnO2ZO387lxmIboLDZCJ59KLFliNIgh9ipt6tLg9SihpRPDO1ia5byw7de1aCQmF5geOQtK509rzfdwxaKOIq+73AvwCC5/5fcV4vo3+3LpMdtWHh0ywsJC/ZGoCb8/9D8F/ifgLLl8S8QWfU8cAAAAASUVORK5CYII=">
27-
</p>
28-
29-
<p align="center">
30-
<strong>
31-
<a href="CONTRIBUTING.md">Contributing<a/>
32-
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
33-
<a href="docs/vision.md">Vision<a/>
34-
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
35-
<a href="docs/design.md">Design<a/>
36-
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
37-
<a href="docs/monitoring.md">Monitoring<a/>
38-
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
39-
<a href="docs/performance.md">Performance<a/>
40-
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
41-
<a href="docs/roadmap.md">Roadmap<a/>
42-
</strong>
43-
</p>
44-
45-
---
46-
47-
48-
### OpenTelemetry Collector
49-
50-
The OpenTelemetry Collector offers a vendor-agnostic implementation on how to receive, process, and export telemetry data. In addition, it removes the need to run, operate, and maintain multiple agents/collectors in order to support open-source telemetry data formats (e.g. Jaeger, Prometheus, etc.) sending to multiple open-source or commercial back-ends.
51-
52-
Objectives:
53-
54-
- Usable: Reasonable default configuration, supports popular protocols, runs and collects out of the box.
55-
- Performant: Highly stable and performant under varying loads and configurations.
56-
- Observable: An exemplar of an observable service.
57-
- Extensible: Customizable without touching the core code.
58-
- Unified: Single codebase, deployable as an agent or collector with support for traces, metrics, and logs (future).
59-
60-
### Community Roles
61-
62-
Triagers ([@open-telemetry/collector-triagers](https://github.com/orgs/open-telemetry/teams/collector-triager))
63-
- [Jay Camp](https://github.com/jrcamp), Splunk
64-
- [Steve Flanders](https://github.com/flands), Splunk
65-
66-
Approvers ([@open-telemetry/collector-approvers](https://github.com/orgs/open-telemetry/teams/collector-approvers)):
67-
68-
- [Dmitrii Anoshin](https://github.com/dmitryax), Splunk
69-
- [James Bebbington](https://github.com/james-bebbington), Google
70-
- [Nail Islamov](https://github.com/nilebox), Google
71-
- [Owais Lone](https://github.com/owais), Splunk
72-
73-
Maintainers ([@open-telemetry/collector-maintainers](https://github.com/orgs/open-telemetry/teams/collector-maintainers)):
74-
75-
- [Bogdan Drutu](https://github.com/BogdanDrutu), Splunk
76-
- [Paulo Janotti](https://github.com/pjanotti), Splunk
77-
- [Tigran Najaryan](https://github.com/tigrannajaryan), Splunk
78-
79-
Learn more about roles in the [community repository](https://github.com/open-telemetry/community/blob/master/community-membership.md).
80-
81-
Thanks to all the people who already contributed!
82-
83-
<a href="https://github.com/open-telemetry/opentelemetry-collector/graphs/contributors">
84-
<img src="https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-collector" />
85-
</a>
1+
# OpenTelemetry Collector O11y
2+
3+
This repository is focused on building and packaging the OpenTelemetry Collector with a Prometheus remote write exporter
4+
supporting Sig V4 to export to AWS services. See [Testing](#testing) section on how to generate and send a OTLP metric
5+
load to a
6+
Prometheus remote write backend.
7+
8+
## Components
9+
10+
Most upstream components are removed and not included in the build. Available components are:
11+
12+
* Receiver: OpenTelemetry Protocol(OTLP) receiver
13+
* Processor: None
14+
* Exporter: Logging exporter, Prometheus remote write exporter
15+
16+
A Collector pipeline with these components is illustrated below:
17+
18+
![Image: Repo README.png](./img/Pipeline.png)
19+
20+
21+
## Initialization
22+
23+
Components in the collector are initialized by the Collector Service based on configuration. The factory and
24+
configuration of a component are invoked at the initialization of the Collector Application, and they supply the
25+
components with parameters components need. AWS Sig V4 support could be passed to the exporter by the factory without
26+
impacting the data conversion and export logic.
27+
28+
The Prometheus remote write exporter use this pattern. During application initialization, the collector asks exporter
29+
builders, a service package component, for an implementation of the MetricExporter interface. Then, the exporter builder
30+
invokes the factory code inside the Prometheus Remote Write Exporter package to create an instance of the Prometheus
31+
Remote Write Exporter. When invoked, factory uses the exporter helper package to wrap the Exporter implementation
32+
inside the MetricExporter interface, and returns the instance to the Collector Application. **The factory can also
33+
pass in an [Sig V4 interceptor-attached http.Client](https://github.com/open-o11y/opentelemetry-collector/blob/d21a840612d40d935ccd52142f06e7106ee82384/exporter/prometheusremotewriteexporter/factory.go#L181)
34+
to the exporter**. Finally, the Collector Application
35+
assembles the export pipeline with the exporter. During an export operation, the exporter behaves the same, but the
36+
interceptor-attached http.Client performs signing of each request.
37+
38+
![Image: Class Diagram(2).png](./img/ClassDiagram.png)
39+
40+
## Sample Configuration
41+
42+
The following is a configuration for a Collector instance that receives gRPC OTLP metrics on `localhost:55680`, a
43+
logging exporter that logs metric to `stdout`, and a Prometheus remote write exporter sending to an endpoint with AWS
44+
Sig V4 support enabled.
45+
46+
```
47+
receivers:
48+
otlp:
49+
protocols:
50+
grpc:
51+
exporters:
52+
prometheusremotewrite:
53+
endpoint: "https://aps-workspaces-beta.us-west-2.amazonaws.com/workspaces/yang-yu-intern-test-ws/remote_write"
54+
namespace: otel-collector
55+
auth:
56+
region: "us-west-2"
57+
service: "aps"
58+
timeout: 10s
59+
logging:
60+
loglevel: debug
61+
62+
service:
63+
extensions:
64+
pipelines:
65+
metrics:
66+
receivers: [otlp]
67+
exporters: [logging,prometheusremotewrite]
68+
```
69+
70+
see a complete list of configuration options and explanation of the prometheus remote write exporter [here](./exporter/prometheusremotewriteexporter/README.md)
71+
72+
## Testing
73+
74+
To test the exporter, run the following command:
75+
76+
```
77+
make testaps
78+
```
79+
80+
This starts a Collector based on configuration in `/test/otel-config.yaml` and runs OTLP metric load generator to send
81+
metrics to the exporter. OTLP metrics are generated based on `/test/otlploadgenerator/data.txt`. After the load generator exists,
82+
it runs a querier to get metrics from the specified endpoint and write the output in `/test/querier/ans.txt`.
83+
84+
More details of testing, load generator and querier are described [here](./test/README.md).
85+

consumer/pdatautil/pdatautil.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ func CloneMetricsDataOld(md consumerdata.MetricsData) consumerdata.MetricsData {
136136
clone.Metrics = append(clone.Metrics, metricClone)
137137
}
138138
}
139-
140139
return clone
141140
}
142141

0 commit comments

Comments
 (0)