File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -44,11 +44,21 @@ def to_series(self): # type: ignore[override]
4444 from datadog_api_client .v2 .model .metric_point import MetricPoint
4545 from datadog_api_client .v2 .model .metric_series import MetricSeries
4646
47- intake_type = {
47+ # Map our MetricKind to Datadog's MetricIntakeType
48+ # Note: DISTRIBUTION may not be available in all datadog-api-client versions
49+ intake_type_map = {
4850 MetricKind .GAUGE : MetricIntakeType .GAUGE ,
4951 MetricKind .COUNT : MetricIntakeType .COUNT ,
50- MetricKind .DISTRIBUTION : MetricIntakeType .DISTRIBUTION ,
51- }[self .kind ]
52+ }
53+ # Fallback to GAUGE if DISTRIBUTION is not available
54+ if self .kind == MetricKind .DISTRIBUTION :
55+ if hasattr (MetricIntakeType , "DISTRIBUTION" ):
56+ intake_type = MetricIntakeType .DISTRIBUTION
57+ else :
58+ # DISTRIBUTION not supported, use GAUGE as fallback
59+ intake_type = MetricIntakeType .GAUGE
60+ else :
61+ intake_type = intake_type_map [self .kind ]
5262
5363 return MetricSeries (
5464 metric = self .name ,
You can’t perform that action at this time.
0 commit comments