Commit c09c036
committed
out_stackdriver: fix metric accounting for dropped records and decouple logic
This patch refactors the response handling in the stackdriver output plugin to resolve incorrect metric accounting and inconsistent behavior between builds with and without Prometheus metrics enabled.
1. Defer Metric Accounting to Core Engine: Removed manual increment of cmt_dropped_records on standard 4xx errors. The core engine automatically increments drop counters when the plugin returns FLB_ERROR. Manual increments caused double counting. This aligns with how other plugins (like out_cloudwatch_logs) defer core accounting to the engine.
2. Decouple Core Logic from Metrics: Moved parse_partial_success_response and partial success return code handling outside of #ifdef FLB_HAVE_METRICS. This ensures that partial successes always return FLB_OK (clearing the chunk from queue) regardless of whether metrics telemetry is enabled, preventing unnecessary retries and ensuring consistent behavior across different build configurations.
3. Added Visibility Logging: Added a warning log for partial successes that reports the exact number of failed records, providing operator visibility into silent drops.
4. Style Guide Compliance: Ensured all variables are declared at the beginning of the function scope as required by Fluent Bit style guidelines.
Signed-off-by: pdewilde <pdewilde@google.com>1 parent 9965c1c commit c09c036
1 file changed
Lines changed: 36 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2937 | 2937 | | |
2938 | 2938 | | |
2939 | 2939 | | |
| 2940 | + | |
2940 | 2941 | | |
2941 | 2942 | | |
2942 | 2943 | | |
| |||
3069 | 3070 | | |
3070 | 3071 | | |
3071 | 3072 | | |
3072 | | - | |
3073 | 3073 | | |
3074 | 3074 | | |
3075 | 3075 | | |
3076 | 3076 | | |
3077 | 3077 | | |
3078 | 3078 | | |
3079 | 3079 | | |
3080 | | - | |
3081 | | - | |
3082 | | - | |
3083 | | - | |
3084 | | - | |
3085 | | - | |
3086 | | - | |
3087 | | - | |
3088 | | - | |
3089 | | - | |
3090 | | - | |
3091 | | - | |
3092 | | - | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
| 3085 | + | |
3093 | 3086 | | |
3094 | 3087 | | |
3095 | | - | |
3096 | | - | |
3097 | | - | |
3098 | | - | |
3099 | | - | |
3100 | | - | |
3101 | | - | |
| 3088 | + | |
| 3089 | + | |
| 3090 | + | |
| 3091 | + | |
3102 | 3092 | | |
3103 | 3093 | | |
3104 | | - | |
3105 | | - | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
3106 | 3100 | | |
3107 | | - | |
3108 | | - | |
3109 | 3101 | | |
| 3102 | + | |
3110 | 3103 | | |
3111 | | - | |
3112 | | - | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
3113 | 3112 | | |
3114 | 3113 | | |
3115 | 3114 | | |
3116 | 3115 | | |
3117 | | - | |
3118 | | - | |
| 3116 | + | |
| 3117 | + | |
| 3118 | + | |
| 3119 | + | |
| 3120 | + | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
3119 | 3126 | | |
3120 | | - | |
3121 | 3127 | | |
3122 | 3128 | | |
3123 | 3129 | | |
| |||
0 commit comments