← Back to team overview

graphite-dev team mailing list archive

Re: [Question #197571]: How to delete a single Whisper entry?

 

Question #197571 on Graphite changed:
https://answers.launchpad.net/graphite/+question/197571

    Status: Answered => Open

Michael Alford is still having a problem:
Given that there is no built-in solution to this, I am attempting to
modify Carbon and Whisper to accept a value of "None" for a point
record.

I added the following function to both whisper/whisper.py and
carbon/lib/carbon/protocols.py:

def floatOrNone(value):
  try:
    return float(value)  
  except ValueError:
    return None
  except TypeError:
    return None

And then called the above function instead of float() for
MetricLineReceiver, MetricDatagramReceiver, MetricPickleReceiver in
Carbon and in the update and update_many functions of Whisper.

Whisper would then fail when trying to pack a None "value" in pointFormat, so I changed a portion of the __archive_update_many function to:
    if (not previousInterval) or (interval == previousInterval + step):
      if (value == None):
        currentString += struct.pack(pointFormat,0,0)
      else:
        currentString += struct.pack(pointFormat,interval,value)
      previousInterval = interval
    else:
      numberOfPoints = len(currentString) / pointSize
      startInterval = previousInterval - (step * (numberOfPoints-1))
      packedStrings.append( (startInterval,currentString) )
      if (value == None):
        currentString = struct.pack(pointFormat,0,0)
      else:
        currentString = struct.pack(pointFormat,interval,value)

I am now getting no error but I am still failing to delete the record.
It seems that saving a zero timestamp in a place in the database that
should have a different timestamp should create a situation where the
point record is effectively deleted, based on Michael Leinartas' comment
above about what happens when a timestamp mismatch occurs.

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.