|
15 | 15 | #ifndef OPENCENSUS_STATS_TAG_SET_H_ |
16 | 16 | #define OPENCENSUS_STATS_TAG_SET_H_ |
17 | 17 |
|
18 | | -#include <initializer_list> |
19 | | -#include <string> |
20 | | -#include <utility> |
21 | | -#include <vector> |
22 | | - |
23 | | -#include "absl/strings/string_view.h" |
24 | | -#include "opencensus/stats/tag_key.h" |
| 18 | +#include "absl/base/macros.h" |
| 19 | +#include "opencensus/tags/tag_map.h" |
25 | 20 |
|
26 | 21 | namespace opencensus { |
27 | 22 | namespace stats { |
28 | 23 |
|
29 | | -// TagSet represents a set of key-value tags, and provides efficient equality |
30 | | -// and hash operations. A TagSet is expensive to construct, and should be shared |
31 | | -// between uses where possible. |
32 | | -// TagSet is immutable. |
33 | | -class TagSet final { |
34 | | - public: |
35 | | - // Both constructors are not explicit so that Record({}, {{"k", "v"}}) works. |
36 | | - // This constructor is needed because even though we copy to a vector |
37 | | - // internally because c++ cannot deduce the conversion needed. |
38 | | - TagSet(std::initializer_list<std::pair<TagKey, absl::string_view>> tags); |
39 | | - // This constructor is needed so that callers can dynamically construct |
40 | | - // tagsets. It takes the argument by value to allow it to be moved. |
41 | | - TagSet(std::vector<std::pair<TagKey, std::string>> tags); |
42 | | - |
43 | | - // Accesses the tags sorted by key (in an implementation-defined, not |
44 | | - // lexicographic, order). |
45 | | - const std::vector<std::pair<TagKey, std::string>>& tags() const { |
46 | | - return tags_; |
47 | | - } |
48 | | - |
49 | | - struct Hash { |
50 | | - std::size_t operator()(const TagSet& tag_set) const; |
51 | | - }; |
52 | | - |
53 | | - bool operator==(const TagSet& other) const; |
54 | | - bool operator!=(const TagSet& other) const { return !(*this == other); } |
55 | | - |
56 | | - // Returns a human-readable string for debugging. Do not rely on its format or |
57 | | - // try to parse it. Do not use it to retrieve tags. |
58 | | - std::string DebugString() const; |
59 | | - |
60 | | - private: |
61 | | - void Initialize(); |
62 | | - |
63 | | - std::size_t hash_; |
64 | | - // TODO: add an option to store string_views to avoid copies. |
65 | | - std::vector<std::pair<TagKey, std::string>> tags_; |
66 | | -}; |
| 24 | +ABSL_DEPRECATED( |
| 25 | + "TagSet has moved to opencensus::tags::TagMap. This is a " |
| 26 | + "compatibility shim and will be removed on or after 2019-03-20") |
| 27 | +typedef opencensus::tags::TagMap TagSet; |
67 | 28 |
|
68 | 29 | } // namespace stats |
69 | 30 | } // namespace opencensus |
|
0 commit comments