+ {`Enable streaming for different Tempo features.
+ Currently supported only for search queries and from Tempo version ${featuresToTempoVersion[FeatureName.streaming]} onwards.`}
+
+ Learn more
+
+
+ }
+ >
+
+ If your Tempo instance is behind a load balancer or proxy that does not supporting gRPC or HTTP2, streaming will
+ probably not work and should be disabled.
+
+
+
+ ) => {
+ updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'streamingEnabled', {
+ ...options.jsonData.streamingEnabled,
+ search: event.currentTarget.checked,
+ });
+ }}
+ />
+
+
+
+ );
+};
+const getStyles = (theme: GrafanaTheme2) => {
+ return {
+ a: css({
+ color: theme.colors.text.link,
+ textDecoration: 'underline',
+ marginLeft: '5px',
+ '&:hover': {
+ textDecoration: 'none',
+ },
+ }),
+ };
+};
diff --git a/public/app/plugins/datasource/tempo/datasource.test.ts b/public/app/plugins/datasource/tempo/datasource.test.ts
index 771220631ee..43dbb94b2a7 100644
--- a/public/app/plugins/datasource/tempo/datasource.test.ts
+++ b/public/app/plugins/datasource/tempo/datasource.test.ts
@@ -75,7 +75,7 @@ describe('Tempo data source', () => {
const range = {
from: dateTime(new Date(2022, 8, 13, 16, 0, 0, 0)),
to: dateTime(new Date(2022, 8, 13, 16, 15, 0, 0)),
- raw: { from: '15m', to: 'now' },
+ raw: { from: 'now-15m', to: 'now' },
};
const traceqlQuery = {
targets: [{ refId: 'refid1', queryType: 'traceql', query: '{}' }],
@@ -365,9 +365,14 @@ describe('Tempo data source', () => {
describe('test the testDatasource function', () => {
it('should return a success msg if response.ok is true', async () => {
mockObservable = () => of({ ok: true });
+ const handleStreamingSearch = jest
+ .spyOn(TempoDatasource.prototype, 'handleStreamingSearch')
+ .mockImplementation(() => of({ data: [] }));
+
const ds = new TempoDatasource(defaultSettings);
const response = await ds.testDatasource();
expect(response.status).toBe('success');
+ expect(handleStreamingSearch).toHaveBeenCalled();
});
});
@@ -389,7 +394,7 @@ describe('Tempo data source', () => {
const range = {
from: dateTime(new Date(2022, 8, 13, 16, 0, 0, 0)),
to: dateTime(new Date(2022, 8, 13, 16, 15, 0, 0)),
- raw: { from: '15m', to: 'now' },
+ raw: { from: 'now-15m', to: 'now' },
};
const request = ds.traceIdQueryRequest(
@@ -434,7 +439,7 @@ describe('Tempo data source', () => {
range: {
from: dateTime(new Date(2022, 8, 13, 16, 0, 0, 0)),
to: dateTime(new Date(2022, 8, 13, 16, 15, 0, 0)),
- raw: { from: '15m', to: 'now' },
+ raw: { from: 'now-15m', to: 'now' },
},
},
[{ refId: 'refid1', queryType: 'traceql', query: '' } as TempoQuery]
@@ -1264,6 +1269,9 @@ export const defaultSettings: DataSourceInstanceSettings