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

Export metrics for failed exported logs in BatchLogRecordProcessor #6709

Open
qixiaogang opened this issue Sep 11, 2024 · 6 comments
Open

Export metrics for failed exported logs in BatchLogRecordProcessor #6709

qixiaogang opened this issue Sep 11, 2024 · 6 comments
Labels
Feature Request Suggest an idea for this project

Comments

@qixiaogang
Copy link

Is your feature request related to a problem? Please describe.
In BatchLogRecordProcessor, it exposed metrics for dropped and exported logs, but didn't expose for failed logs. while export failure is critical and need to expose as metrics.

Describe the solution you'd like
Expose failed export as metrics also.

Describe alternatives you've considered
NA

Additional context
NA

@qixiaogang qixiaogang added the Feature Request Suggest an idea for this project label Sep 11, 2024
@harshitrjpt
Copy link

harshitrjpt commented Sep 20, 2024

what should be the metric here -
no. of logs (batch size) that failed to get exported
or
simply failed export occurrence ?

@qixiaogang
Copy link
Author

qixiaogang commented Sep 25, 2024

hi @harshitrjpt, thanks for checking.
I would prefer no. of logs (batch size) that failed to get exported.

@harshitrjpt
Copy link

hmm.. i was thinking- the end user should be worried about the export failure occurrence or how many logs failed to get exported. How should it matter whether 1 log failed to get exported or 10 logs ?

@qixiaogang
Copy link
Author

qixiaogang commented Oct 10, 2024

hi @harshitrjpt Thanks, in some cases, end user need to know how much logs got loss due to export failure.

@harshitrjpt
Copy link

harshitrjpt commented Oct 10, 2024

@qixiaogang : If that is the use case, then we would just need to define another attribute, similar to 'dropped', for export failure and reuse the same 'processedLogs' metric.

But i am still inclined towards tracking export failure occurrence rather than no. of logs that failed to get exported, because the failure is about the exporter and not the logs.
I'll let the core maintainers- @jkwatson , @jack-berg comment on which way we should go.
(i already have the code added and tested in local for export failure occurrence, just need to create PR)

harshitrjpt added a commit to harshitrjpt/opentelemetry-java that referenced this issue Oct 10, 2024
@harshitrjpt
Copy link

harshitrjpt commented Oct 14, 2024

@qixiaogang I think there is already an existing feature https://github.com/open-telemetry/opentelemetry-java/blob/main/exporters/common/src/main/java/io/opentelemetry/exporter/internal/ExporterMetrics.java you can leverage for your requirement. The ExporterMetrics in generically addresses this need for all exporters.
Credits to @jack-berg for pointing out on my above commit.

I used this on my local repro by enabling OTEL_EXPORTER_METRICS_ENABLED=true and By default got the desired result when using autoconfigure.
The otlp.exporter.exported metric with datapoints - success=false,type=log appropriately tracks the log export failure. Please check if this addresses your need.

ScopeMetrics #2
ScopeMetrics SchemaURL:
InstrumentationScope io.opentelemetry.exporters.otlp-grpc
Metric #0
Descriptor:
     -> Name: otlp.exporter.exported
     -> Description:
     -> Unit:
     -> DataType: Sum
     -> IsMonotonic: true
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
Data point attributes:
     -> success: Bool(false)
     -> type: Str(log)
StartTimestamp: 2024-10-14 10:06:54.40763 +0000 UTC
Timestamp: 2024-10-14 10:10:54.418291 +0000 UTC
Value: 9
Metric #1
Descriptor:
     -> Name: otlp.exporter.seen
     -> Description:
     -> Unit:
     -> DataType: Sum
     -> IsMonotonic: true
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
Data point attributes:
     -> type: Str(log)
StartTimestamp: 2024-10-14 10:06:54.40763 +0000 UTC
Timestamp: 2024-10-14 10:10:54.418291 +0000 UTC
Value: 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Suggest an idea for this project
Projects
None yet
Development

No branches or pull requests

2 participants