Conversation
start-local.sh
Outdated
|
|
||
| exporters: | ||
| elasticsearch: | ||
| endpoint: http://elasticsearch:9200 |
There was a problem hiding this comment.
| endpoint: http://elasticsearch:9200 | |
| endpoints: [ "http://elasticsearch:9200" ] |
Shouldn't this be plural?
There was a problem hiding this comment.
I just copy & paste from here where it's singular.
There was a problem hiding this comment.
The source of truth should be the collector documentation:
https://www.elastic.co/docs/reference/opentelemetry/edot-collector/config/default-config-standalone
This is the example config for the collector in agent mode (i.e. will export to ES) that will also collect logs and generate metrics from the host https://raw.githubusercontent.com/elastic/elastic-agent/refs/tags/v9.0.3/internal/pkg/otel/samples/linux/logs_metrics_traces.yml
I think it's a bit too much but maybe hostmetrics are a good source of data to do some smoke testing? i.e. you can check that you can query them in elasticsearch
There was a problem hiding this comment.
There was a problem hiding this comment.
@rogercoll let's chat to get your support on generating a configuration that can enable us to deploy EDOT collector as a gateway for the start-local effort. So far I have referenced the one we are using for K8s gateway, but we might need to hardcode the endpoints and enrichment processors.
There was a problem hiding this comment.
Both endpoint and endpoints configurations are supported in the Elasticsearch exporter. The first one is because the exporter embedding the upstream confighttp configuration: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/elasticsearchexporter/config.go#L69C13-L69C25
The latest was previously added because alignment with elasticsearch-go client configuration: https://github.com/elastic/go-elasticsearch/blob/main/elasticsearch.go#L71
Not a strong opinion, but maybe use endpoints as being the one used in our public docs: https://www.elastic.co/docs/reference/opentelemetry/edot-collector/config/default-config-standalone#data-export
|
Do you plan to also generate a dedicated API key for the otel ingestion like it's currently provided for ES clients ? Without that users would have to perform another manual step to generate the API key before being able to send otel data to the otel collector. |
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
|
@SylvainJuge it this API key different from the ES one? Can you point me to any documentation about it? Thanks. I don't know if it's different, but there is dedicated UI for in in Kibana, also you can use https://www.elastic.co/docs/api/doc/kibana/operation/operation-createagentkey to create a new one for APM agents (which also includes EDOT SDKs). |
| if [ -z "${esonly:-}" ]; then | ||
| if [ "$otel" = "true" ]; then | ||
| cat >> .env <<- EOM | ||
| ES_LOCAL_JAVA_OPTS="-Xms2g -Xmx2g" |
There was a problem hiding this comment.
Do we set that Xms to 2GB intentionally? I don't think we'll compare well to Grafana's stack and others like that ("big", "bloated",...). We should IMO still initialize as small as possible with the necessary room to grow if needed. Even if we take a small performance hit when needing to increase the heap size.
There was a problem hiding this comment.
Yeah, IMO this can (should) use the same settings and general approach used for the other options. We still want this to start really lightweight.
mlunadia
left a comment
There was a problem hiding this comment.
added comments about imaged used and collector config.
start-local.sh
Outdated
| if [ "$otel" = "true" ]; then | ||
| cat >> uninstall.sh <<- EOM | ||
| if docker rmi docker.elastic.co/elastic-agent/elastic-otel-collector:${es_version} >/dev/null 2>&1; then | ||
| echo "Image docker.elastic.co/elastic-agent/elastic-otel-collector:${es_version} removed successfully" |
There was a problem hiding this comment.
@ezimuel we should be using the image of Elastic Agent and trigger otel mode, there is a flag that enables the Elastic Agent container to start in otel mode = EDOT
There was a problem hiding this comment.
@mlunadia Are we interested in any other Elastic Agent binaries/features except the Otel collector? If we are only interested in the EDOT collector I would recommend using the elastic-agent/elastic-otel-collector image as being smaller than the main elastic-agent image: elastic/elastic-agent#7173
There was a problem hiding this comment.
just EDOT collector for start-local, for edge we might add examples later
| # Add the OTLP configs in docker-compose.yml | ||
| cat >> docker-compose.yml <<-'EOM' | ||
| configs: | ||
| # This is the minimal yaml configuration needed to listen on all interfaces |
There was a problem hiding this comment.
We'll need to work on this config as we are missing some of the core processors like batch. As reference we can begin using this configuration with the exception of the inframetrics processor which is marked for removal in it. https://github.com/elastic/elastic-agent/blob/main/internal/pkg/otel/samples/linux/gateway.yml
start-local.sh
Outdated
|
|
||
| exporters: | ||
| elasticsearch: | ||
| endpoint: http://elasticsearch:9200 |
There was a problem hiding this comment.
@rogercoll let's chat to get your support on generating a configuration that can enable us to deploy EDOT collector as a gateway for the start-local effort. So far I have referenced the one we are using for K8s gateway, but we might need to hardcode the endpoints and enrichment processors.
start-local.sh
Outdated
|
|
||
| exporters: | ||
| elasticsearch: | ||
| endpoint: http://elasticsearch:9200 |
There was a problem hiding this comment.
Both endpoint and endpoints configurations are supported in the Elasticsearch exporter. The first one is because the exporter embedding the upstream confighttp configuration: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/elasticsearchexporter/config.go#L69C13-L69C25
The latest was previously added because alignment with elasticsearch-go client configuration: https://github.com/elastic/go-elasticsearch/blob/main/elasticsearch.go#L71
Not a strong opinion, but maybe use endpoints as being the one used in our public docs: https://www.elastic.co/docs/reference/opentelemetry/edot-collector/config/default-config-standalone#data-export
| connectors: | ||
| elasticapm: | ||
|
|
||
| processors: |
There was a problem hiding this comment.
Could we add a couple of batch processor configurations? batch for logs and traces pipelines while batch/metrics for metrics pipelines, sample configuration: https://github.com/elastic/elastic-agent/blob/main/internal/pkg/otel/samples/linux/gateway.yml#L38-L44
(note that they need to be referenced in the pipeline's configuration too)
start-local.sh
Outdated
| logs_dynamic_index: | ||
| enabled: true | ||
| metrics_dynamic_index: | ||
| enabled: true | ||
| traces_dynamic_index: | ||
| enabled: true |
There was a problem hiding this comment.
This should be removed as being deprecated:
No-op. Documents are now always routed dynamically unless logs_index is not empty. Will be removed in a future version.
start-local.sh
Outdated
| # Kibana settings container name | ||
| kibana_settings_container_name="kibana-local-settings${ES_LOCAL_DIR:+-${ES_LOCAL_DIR}}" | ||
| # OTEL container name | ||
| otel_container_name="otel-collector${ES_LOCAL_DIR:+-${ES_LOCAL_DIR}}" |
There was a problem hiding this comment.
Wdyt of renaming the container name to elastic-otel-collector or edot-collector to differentiate from the upstream image?
There was a problem hiding this comment.
Because we can have different services based on the version (--v option) and to avoid conflict we need to have different names.
There was a problem hiding this comment.
Sorry, I should have worded that better. My suggestion would be to include the edot keyword on the container name prefix:
| otel_container_name="otel-collector${ES_LOCAL_DIR:+-${ES_LOCAL_DIR}}" | |
| otel_container_name="edot-collector${ES_LOCAL_DIR:+-${ES_LOCAL_DIR}}" |
| processors: | ||
| elastictrace: | ||
|
|
||
| exporters: |
There was a problem hiding this comment.
Could we add the debug exporter with the default configuration? That is really helpful to quickly check if data is being received by the collector, similar to https://github.com/elastic/elastic-agent/blob/main/internal/pkg/otel/samples/linux/gateway.yml#L48
Co-authored-by: Roger Coll <roger.coll@elastic.co>
Co-authored-by: Roger Coll <roger.coll@elastic.co>
|
@rogercoll and @mlunadia I updated the PR with the requested changes. Thanks. |
| mapping: | ||
| mode: otel | ||
|
|
||
| service: |
There was a problem hiding this comment.
| service: | |
| service: | |
| telemetry: | |
| metrics: | |
| readers: | |
| - pull: | |
| exporter: | |
| prometheus: | |
| host: '0.0.0.0' | |
| port: 8888 |
One way to test the container is up and running would be exposing the collector's internal metrics through a Prometheus exporter interface. Then, we can assert the response code of curl http://edot-collector:8888/metrics
There was a problem hiding this comment.
Another approach, that would not require exposing the collector's internal metrics, would be sending a testing payload to the already available http OTLP endpoint. Example:
$ curl -X POST http://localhost:4318/v1/logs \
-H "Content-Type: application/json" \
-d '{
"Timestamp": "1634630400000",
"ObservedTimestamp": "1634630401000",
"TraceId": "abcd1234",
"SpanId": "efgh5678",
"SeverityText": "DEBUG",
"SeverityNumber": "5",
"Body": "Testing log to assert collector OTLP endpoint",
"Resource": {
"service.name": "start-local-testing"
},
"InstrumentationScope": {},
"Attributes": {}
}' \
-o /dev/null -s -w "%{http_code}\n"
200There was a problem hiding this comment.
Thanks @rogercoll, I think we'll choose this approach since this does not require changing the configuration.
All suggestions have been applied
This PR add the EDOT (Elastic Distribution of OpenTelemetry) collector in start-local using the option
--edot. This is done using theedot_collectorconfiguration reported here.This PR should address the request in #55.
To test the
--edotoption we can run the following command:curl -fsSL https://raw.githubusercontent.com/elastic/start-local/refs/heads/feature/otel/start-local.sh | sh -s -- --edotTo be done:
tests--edotoption inREADME.md