Example #1
0
 /// <summary>
 /// Create a new tag.
 /// </summary>
 /// <param name="Id">The unique identification of the user tag.</param>
 /// <param name="Description">An optional (multi-language) description of the user tag.</param>
 public Tag(Tag_Id Id,
            I18NString Description = null)
 {
     this.Id          = Id;
     this.Description = Description ?? new I18NString();
     this.Tags        = new Tags.Builder();
 }
    public void should_serialize_measure_into_influx_format() {
      var tags =
        new Tags.Builder()
          .WithTag("tag1", "tagValue1")
          .Build();
      var config = new MetricConfig("myMetric", tags);
      var measure = new Measure(config, 1000);

      var date = DateTime.Now;
      var api = new ApiEndpointMock();
      var observer = new InfluxObserver(api, TimeSpan.FromMilliseconds(50));
      observer.Observe(measure, date);
      observer.Observe(measure, date);

      long epoch = date.ToUnixEpoch().ToNanos(TimeUnit.Seconds);
      string points = "myMetric,{0} value={1} {2}\nmyMetric,{0} value={1} {2}\n"
        .Fmt("tag1=tagValue1", measure.Value, epoch.ToString());

      Thread.Sleep(TimeSpan.FromMilliseconds(100));

      Assert.That(api.PostedSeries, Is.EqualTo(points));
    }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetricConfig"/> class by
 /// using the given name and tags.
 /// </summary>
 /// <param name="name">
 /// A string that, in conjuction with the tags, uniquely identifies a
 /// metric.
 /// </param>
 /// <param name="tags">
 /// A collection of key/value pairs that, in conjuction with the name
 /// uniquely identifies the metric.
 /// </param>
 public MetricConfig(string name, Tags tags) {
   Name = name;
   Tags = new Tags.Builder()
     .WithTags(tags)
     .Build();
 }