LabelValuesStream returns all label values that are associated with a given label name.
(req *client.LabelValuesRequest, stream client.Ingester_LabelValuesStreamServer)
| 1891 | |
| 1892 | // LabelValuesStream returns all label values that are associated with a given label name. |
| 1893 | func (i *Ingester) LabelValuesStream(req *client.LabelValuesRequest, stream client.Ingester_LabelValuesStreamServer) (err error) { |
| 1894 | defer recoverIngester(i.logger, &err) |
| 1895 | |
| 1896 | ctx := stream.Context() |
| 1897 | userID, userErr := users.TenantID(ctx) |
| 1898 | if userErr != nil { |
| 1899 | return userErr |
| 1900 | } |
| 1901 | |
| 1902 | // Set pprof labels for profiling |
| 1903 | pprof.Do(ctx, pprof.Labels("user", userID), func(ctx context.Context) { |
| 1904 | var resp *client.LabelValuesResponse |
| 1905 | var cleanup func() |
| 1906 | resp, cleanup, err = i.labelsValuesCommon(ctx, req) |
| 1907 | defer cleanup() |
| 1908 | |
| 1909 | if err != nil { |
| 1910 | return |
| 1911 | } |
| 1912 | |
| 1913 | for i := 0; i < len(resp.LabelValues); i += metadataStreamBatchSize { |
| 1914 | j := min(i+metadataStreamBatchSize, len(resp.LabelValues)) |
| 1915 | resp := &client.LabelValuesStreamResponse{ |
| 1916 | LabelValues: resp.LabelValues[i:j], |
| 1917 | } |
| 1918 | err = client.SendLabelValuesStream(stream, resp) |
| 1919 | if err != nil { |
| 1920 | return |
| 1921 | } |
| 1922 | } |
| 1923 | }) |
| 1924 | |
| 1925 | return err |
| 1926 | } |
| 1927 | |
| 1928 | // labelsValuesCommon returns all label values that are associated with a given label name. |
| 1929 | // this should be used by LabelValues and LabelValuesStream |
nothing calls this directly
no test coverage detected