influxdata / influxdata/telegraf
Otel output is not setting the start time on non-gauge values
- Dominant language
- Go
- Stars
- 17.8k
- Forks
- 5.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 161
Description
### Relevant telegraf.conf
```toml
[agent]
interval = "30s"
[[inputs.mem]]
[[outputs.file]]
files = ["stdout"]
[[inputs.cpu]]
percpu = false
totalcpu = true
collect_cpu_time = false
report_active = false
core_tags = false
[[inputs.diskio]]
devices = ["nvme*"]
device_tags = ["ID_FS_LABEL", "ID_SERIAL_SHORT"]
[[outputs.opentelemetry]]
service_address = ""
tls_ca = "/etc/ssl/certs/ca-certificates.crt"
[outputs.opentelemetry.attributes]
"service.name" = ""
[outputs.opentelemetry.headers]
lightstep-access-token = ""
```
### Logs from Telegraf
```text
> cpu,cpu=cpu-total,host=REDACTED,location=sjc usage_guest=0,usage_guest_nice=0,usage_idle=99.93757808692158,usage_iowait=0,usage_irq=0,usage_nice=0,usage_softirq=0,usage_steal=0,usage_system=0.062421972666786965,usage_user=0 1675722610000000000
> diskio,ID_SERIAL_SHORT=50FF306WFY8L,host=REDACTED,name=nvme0n1p2 io_time=5201120i,iops_in_progress=0i,merged_reads=0i,merged_writes=5260106i,read_bytes=65475343360i,read_time=2442680i,reads=1441098i,weighted_io_time=30143220i,write_bytes=1147246014464i,write_time=51269676i,writes=15001487i 1675722610000000000
```
### System info
1.25.0
### Docker
_No response_
### Steps to reproduce
1. Configure telegraf per the supplied configuration
2. Fill in the otel endpoint information
3. All values are sent to the remote API, but not all are valid. This can result in only gauges being displayed by your otel compliant vendor (behavior depends on your otel service vendor)
### Expected behavior
Metrics of all telegraf types are converted to the otel type such that the start time represents the intended semantics per the otel spec. Which in turn results in the service provider parsing and correctly displaying these values.
### Actual behavior
Otel compliant vendors see the "start" as epoch start (the proto default), which results in them not being displayed as anticipated. This appears to be due to the conversion of telegraf metrics to otel ones such that sum types lack a `StartTimeUnixNano` [1]. I'm not at all familiar with the code base, however 😄
[1] https://opentelemetry.io/docs/reference/specification/metrics/data-model/
### Additional info
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.