cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Timeseries Chart data points data type

gilgi
DynaMight Champion
DynaMight Champion

Hi, 

Looking at the documentation I see the following:

gilgi_0-1701338210570.png

the Timeseries  data has datapoints of type "TimeseriesDatapoint". However, looking at the timeseries interface I see the following:

 

export interface Timeseries {
    /** The datapoints recordset for this time series */
    datapoints:     [];
    /** The name or names in case of multiple dimensions for the time series */
    name: string | string[];
    /** Unit token for the value represented by the timeseries datapoints. Eg: 'kbit/s'  */
    unit?: TimeseriesUnit;
    /** Custom data to be added to a Timeseries series payload */
    userData?: Record<string, any>;
}

 

 

In my code I have the following:

 

const timeSeriesData:Timeseries = {
                    name: dimensionName,
                    unit: 'percent',
                    datapoints: sloChartDataPoints
                }

 

sloChartDataPoints is of type Array<TimeseriesDatapoint>.

The error I get is:

Type 'TimeseriesDatapoint[]' is not assignable to type '[]'.
Target allows only 0 element(s) but source may have more.ts(2322)
timeseries.d.ts(26, 5): The expected type comes from property 'datapoints' which is declared here on type 'Timeseries'
 
What am I missing?
7 REPLIES 7

educampver
Dynatrace Advisor
Dynatrace Advisor

Hi @gilgi, what version of Strato are you using? Please update to the latest: 0.108.6.

Best, Edu.

gilgi
DynaMight Champion
DynaMight Champion


Hi @educampver 

I am actually running 0.109.0 ( that was the latest installed yesterday or a day before that...)

Gil.

educampver
Dynatrace Advisor
Dynatrace Advisor

Weird, I see it fine in 0.109.0:

 

export interface Timeseries {
    /** The datapoints recordset for this time series */
    datapoints: TimeseriesDatapoint[];
    /** The name or names in case of multiple dimensions for the time series */
    name: string | string[];
    /** Unit token for the value represented by the timeseries datapoints. Eg: 'kbit/s'  */
    unit?: TimeseriesUnit;
    /** Custom data to be added to a Timeseries series payload */
    userData?: Record<string, any>;
}

 

The only way I've found to reproduce this issue is by manually removing the TimeseriesDatapoint type in the Timeseries type definition. Is it possible this happened by mistake?

Try reinstalling it maybe it'll fix it: npm install @dynatrace/strato-components-preview@latest

gilgi
DynaMight Champion
DynaMight Champion

I've done so and it was the same. Have updated the file manually but not sure this is the right way to go.

educampver
Dynatrace Advisor
Dynatrace Advisor

It's definitely not the way to go, and everything looks fine on our end, so I'm not sure how to proceed. Is this a new app you just created? Can you try creating a new app from scratch and checking the type definition?

PennyScully
Dynatrace Contributor
Dynatrace Contributor

@gilgi Just checking in. Did you find a solution to this problem? 

gilgi
DynaMight Champion
DynaMight Champion

Hi @PennyScully 

In the emanwhile I kept the manual changes, while I know it's not the way to go, but just didn't have the time to try and create a new app. In my case it wasn't a new app. The upgrade of the version did add the migration comment to my code warning me about the change, so I assume it has something to do wilth the my specific windows environment.

Thanks for following up!

Featured Posts